parse dynamic import correctly (#4671)
This commit is contained in:
parent
8d668c2963
commit
ae09773ba0
|
|
@ -848,8 +848,10 @@ function parse($TEXT, options) {
|
||||||
next();
|
next();
|
||||||
return export_();
|
return export_();
|
||||||
case "import":
|
case "import":
|
||||||
next();
|
if (!is_token(peek(), "punc", "(")) {
|
||||||
return import_();
|
next();
|
||||||
|
return import_();
|
||||||
|
}
|
||||||
case "yield":
|
case "yield":
|
||||||
if (S.in_generator) return simple_statement();
|
if (S.in_generator) return simple_statement();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,13 @@ dynamic: {
|
||||||
expect_exact: '(async a=>await import(a))("foo").then(bar);'
|
expect_exact: '(async a=>await import(a))("foo").then(bar);'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic_nought: {
|
||||||
|
input: {
|
||||||
|
import(foo);
|
||||||
|
}
|
||||||
|
expect_exact: "import(foo);"
|
||||||
|
}
|
||||||
|
|
||||||
import_meta: {
|
import_meta: {
|
||||||
input: {
|
input: {
|
||||||
console.log(import.meta, import.meta.url);
|
console.log(import.meta, import.meta.url);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user