enhance imports (#5287)
This commit is contained in:
@@ -459,6 +459,7 @@ Compressor.prototype.compress = function(node) {
|
|||||||
if (ref.in_arg && is_funarg(def)) return false;
|
if (ref.in_arg && is_funarg(def)) return false;
|
||||||
return all(def.orig, function(sym) {
|
return all(def.orig, function(sym) {
|
||||||
if (sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet) {
|
if (sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet) {
|
||||||
|
if (sym instanceof AST_SymbolImport) return true;
|
||||||
return compressor && can_varify(compressor, sym);
|
return compressor && can_varify(compressor, sym);
|
||||||
}
|
}
|
||||||
return !(keep_lambda && sym instanceof AST_SymbolLambda);
|
return !(keep_lambda && sym instanceof AST_SymbolLambda);
|
||||||
|
|||||||
@@ -106,6 +106,22 @@ drop_unused: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drop_side_effect_free: {
|
||||||
|
options = {
|
||||||
|
imports: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
import foo from "bar";
|
||||||
|
var a = foo;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
import "bar";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mangle: {
|
mangle: {
|
||||||
rename = false
|
rename = false
|
||||||
mangle = {
|
mangle = {
|
||||||
|
|||||||
Reference in New Issue
Block a user