fix(bundler): Handle star export with top-level await (#5707)

This commit is contained in:
PolarETech 2022-09-01 20:46:31 +09:00 committed by GitHub
parent 00dde3eed2
commit 2b7cba8a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 0 deletions

View File

@ -370,6 +370,13 @@ where
Callee::Super(_) | Callee::Import(_) => continue,
Callee::Expr(v) => v,
},
Expr::Await(AwaitExpr { arg, .. }) => match &mut **arg {
Expr::Call(CallExpr { callee, .. }) => match callee {
Callee::Super(_) | Callee::Import(_) => continue,
Callee::Expr(v) => v,
},
_ => continue,
},
_ => continue,
},
None => continue,

View File

@ -0,0 +1,2 @@
await Promise.resolve(true);
export * from "./lib1";

View File

@ -0,0 +1,2 @@
import * as lib from "./deps";
console.log(lib);

View File

@ -0,0 +1 @@
export const starExport = 1;

View File

@ -0,0 +1,7 @@
await Promise.resolve(true);
const mod = await async function() {
return {
starExport: 1
};
}();
console.log(mod);

View File

@ -0,0 +1,8 @@
const starExport = 1;
await Promise.resolve(true);
const mod = await async function() {
return {
starExport
};
}();
console.log(mod);