Skip to content

Commit

Permalink
do not inline function declarations into default exports, as they can…
Browse files Browse the repository at this point in the history
…not be turned into function expressions. Closes #800
  • Loading branch information
fabiosantoscode committed Sep 3, 2020
1 parent 587bb71 commit ac292b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/compress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6380,7 +6380,8 @@ def_optimize(AST_SymbolRef, function(self, compressor) {
let single_use = def.single_use
&& !(parent instanceof AST_Call
&& (parent.is_expr_pure(compressor))
|| has_annotation(parent, _NOINLINE));
|| has_annotation(parent, _NOINLINE))
&& !(fixed instanceof AST_Defun && parent instanceof AST_Export);

if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) {
if (retain_top_func(fixed, compressor)) {
Expand Down

0 comments on commit ac292b8

Please sign in to comment.