Skip to content

Commit

Permalink
Fix scopehositing with nested dynamic imports (#2712)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic authored and devongovett committed Mar 3, 2019
1 parent c670dec commit 37e22d3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
@@ -0,0 +1 @@
export default import("./b.js").then(b => b.default);
@@ -0,0 +1 @@
export default import('./c.js').then(b => b.default + 1);
@@ -0,0 +1 @@
export default 122;
12 changes: 12 additions & 0 deletions packages/core/integration-tests/test/scope-hoisting.js
Expand Up @@ -264,6 +264,18 @@ describe('scope hoisting', function() {
assert.equal(await output.default, 5);
});

it('supports nested dynamic imports', async function() {
let b = await bundle(
path.join(
__dirname,
'/integration/scope-hoisting/es6/dynamic-import-dynamic/a.js'
)
);

let output = await run(b);
assert.equal(await output.default, 123);
});

it('should not export function arguments', async function() {
let b = await bundle(
path.join(
Expand Down
Expand Up @@ -384,6 +384,7 @@ class JSConcatPackager extends Packager {
if (this.bundle.assets.has(asset)) {
return;
}
this.assets.set(asset.id, asset);
this.bundle.addAsset(asset);
if (!asset.parentBundle) {
asset.parentBundle = this.bundle;
Expand Down

0 comments on commit 37e22d3

Please sign in to comment.