☂️ Minifier Beta
The goal of this umbrella issue is to better understand the core missing features so that we can address and resolve them in batches rather than applying minor, incremental fixes.
Variable Inlining & Constant Propagation
The minifier only tracks a single constant value per symbol (SymbolValues), and only inlines when a variable has exactly 1 read reference
or the value is trivially small (booleans, short strings, small integers). It cannot inline variables that are read multiple times when it
would still save bytes, cannot propagate constants through reassignments, and cannot inline across scope boundaries.
- #13051
- #16964
- #14310
- #14340
- #15908
- #14075
Function Analysis & Dead Function Elimination
The minifier only recognizes pure functions via explicit annotations (@__PURE__, @__NO_SIDE_EFFECTS__). It cannot automatically detect
that a function is pure by analyzing its body, cannot inline single-use functions or functions that return a constant, and cannot remove
unused functions that only call each other (circular references).
- #13108
- #13651
- #13105
- #17364
- #17480
- #14207
Object & Property Optimization
The minifier has no concept of object shapes. When a variable holds an object literal that is never reassigned, the minifier cannot inline
property values (obj.x → 1), cannot detect and remove unused properties, and cannot mangle property names. Every property access is
treated as opaque.
- #10844
- #10845
- #14331
- #17857
- #17358
- #15375
- #20661
Dead Code Elimination & Statement Optimization
The minifier's dead code elimination is limited to obvious cases (code after return, if(false)). It cannot remove variables whose value
depends only on themselves, cannot optimize switch statements (unreachable cases, single-case-to-if conversion), cannot flatten unnecessary
block statements, and cannot detect unused top-level variables in CommonJS modules.
- #14001
- #17544
- #14311
- #12378
- #17349
- #13047
Globals & Side-Effect Model
The minifier has no model of well-known globals. It doesn't know that Math.max(), Object.keys(), or Array.isArray() are pure and
side-effect-free, so it conservatively keeps all global function calls even when their return values are unused. Similarly, it cannot drop
side-effect-free class instantiations or unused spreads.
- #13067
- #13068
- #13069
- #17157
Mangler Improvements & Bugs
The mangler has scope-handling bugs (catch binding redeclaration, function declarations in try blocks) and lacks optimization opportunities
(import name mangling, JSX component name preservation with mangle.toplevel).
- #15417
- #13248
- #14316
- #17307
Codegen & Output Quality
The code generator has output correctness issues: comments above removed code are lost, lone surrogates are incorrectly printed, and WTF-8 encoding is not used for storing lone surrogates.
- #15265
- #15524
- #16886
Source: oxc-project/oxc