aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-28 23:13:49 +0000
committerGitHub <noreply@github.com>2021-03-01 07:13:49 +0800
commitec0440f26492ff548a670605f232de8e14a93390 (patch)
treeab33d0e2cf42e16687c2b668a086752aaffcefd9 /test/compress
parent81254f67e473f2a1db8341de26cd923f9c592e17 (diff)
downloadtracifyjs-ec0440f26492ff548a670605f232de8e14a93390.tar.gz
tracifyjs-ec0440f26492ff548a670605f232de8e14a93390.zip
fix corner cases with `import` (#4709)
fixes #4708
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/imports.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/compress/imports.js b/test/compress/imports.js
index 558dd6a8..50b3fb69 100644
--- a/test/compress/imports.js
+++ b/test/compress/imports.js
@@ -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";
+ }
+}