Skip to content

Commit

Permalink
Fix tree-shaking named import on wrapped module (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
fathyb authored and devongovett committed Jul 8, 2018
1 parent 23ee7c2 commit a42dfeb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/scope-hoisting/hoist.js
Expand Up @@ -110,6 +110,7 @@ module.exports = {
])
);

asset.cacheData.exports = {};
asset.cacheData.isCommonJS = true;
asset.cacheData.isES6Module = false;
} else {
Expand Down
3 changes: 3 additions & 0 deletions test/integration/scope-hoisting/es6/import-wrapped/a.js
@@ -0,0 +1,3 @@
import {foo} from './b'

output = foo
1 change: 1 addition & 0 deletions test/integration/scope-hoisting/es6/import-wrapped/b.js
@@ -0,0 +1 @@
export const foo = eval("'bar'")
9 changes: 9 additions & 0 deletions test/scope-hoisting.js
Expand Up @@ -311,6 +311,15 @@ describe('scope hoisting', function() {
let output = await run(b);
assert.deepEqual(output, 'foo');
});

it('should support named imports on wrapped modules', async function() {
let b = await bundle(
__dirname + '/integration/scope-hoisting/es6/import-wrapped/a.js'
);

let output = await run(b);
assert.deepEqual(output, 'bar');
});
});

describe('commonjs', function() {
Expand Down

0 comments on commit a42dfeb

Please sign in to comment.