Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scopehositing with nested dynamic imports #2712

Merged
merged 1 commit into from Mar 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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