aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/parse.js6
-rw-r--r--test/compress/imports.js7
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/parse.js b/lib/parse.js
index 04b40149..39465d78 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -848,8 +848,10 @@ function parse($TEXT, options) {
next();
return export_();
case "import":
- next();
- return import_();
+ if (!is_token(peek(), "punc", "(")) {
+ next();
+ return import_();
+ }
case "yield":
if (S.in_generator) return simple_statement();
break;
diff --git a/test/compress/imports.js b/test/compress/imports.js
index cdc239cd..03ebf997 100644
--- a/test/compress/imports.js
+++ b/test/compress/imports.js
@@ -47,6 +47,13 @@ dynamic: {
expect_exact: '(async a=>await import(a))("foo").then(bar);'
}
+dynamic_nought: {
+ input: {
+ import(foo);
+ }
+ expect_exact: "import(foo);"
+}
+
import_meta: {
input: {
console.log(import.meta, import.meta.url);