mirror of https://github.com/webpack/webpack.git
Merge pull request #10196 from webpack/bugfix/10194
generate await code for import without await too
This commit is contained in:
commit
0e2b4f5b93
|
|
@ -236,7 +236,7 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
|
|||
key
|
||||
)
|
||||
);
|
||||
if (dep.await) {
|
||||
if (templateContext.moduleGraph.isAsync(referencedModule)) {
|
||||
templateContext.initFragments.push(
|
||||
new AwaitDependenciesInitFragment(
|
||||
new Set([dep.getImportVar(templateContext.moduleGraph)])
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ const describeCases = config => {
|
|||
mjs: true,
|
||||
asyncWebAssembly: true,
|
||||
topLevelAwait: true,
|
||||
importAwait: true
|
||||
importAwait: true,
|
||||
importAsync: true
|
||||
}
|
||||
};
|
||||
beforeAll(done => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
it("should allow to use import await", () => {
|
||||
return import("./reexport").then(({ default: value, other }) => {
|
||||
expect(value).toBe(42);
|
||||
expect(other).toBe(42);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
await new Promise(r => setTimeout(r, 100));
|
||||
|
||||
export default 42;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
export { default } from "./module";
|
||||
import value from "./module";
|
||||
|
||||
export const other = value;
|
||||
Loading…
Reference in New Issue