fix corner cases with import (#4709)

fixes #4708
This commit is contained in:
Alex Lam S.L
2021-02-28 23:13:49 +00:00
committed by GitHub
parent 81254f67e4
commit ec0440f264
4 changed files with 67 additions and 5 deletions

View File

@@ -165,3 +165,38 @@ forbid_merge: {
f();
}
}
issue_4708_1: {
options = {
imports: true,
toplevel: true,
unused: true,
}
input: {
var a;
import a from "foo";
}
expect: {
var a;
import a from "foo";
}
}
issue_4708_2: {
options = {
imports: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a;
console.log(a);
import a from "foo";
}
expect: {
var a;
console.log(a);
import a from "foo";
}
}