Skip to content

Commit

Permalink
Fix import deep wildcards with tree-shaking (#1681)
Browse files Browse the repository at this point in the history
  • Loading branch information
fathyb authored and devongovett committed Jul 8, 2018
1 parent ec3aea9 commit 23ee7c2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scope-hoisting/concat.js
Expand Up @@ -56,7 +56,7 @@ module.exports = (packager, ast) => {
// If this module exports wildcards, resolve the original module.
// Default exports are excluded from wildcard exports.
let wildcards = module && module.cacheData.wildcards;
if (wildcards && name !== 'default') {
if (wildcards && name !== 'default' && name !== '*') {
for (let source of wildcards) {
let m = findExportModule(resolveModule(id, source).id, name);
if (m.identifier) {
Expand Down
@@ -0,0 +1,4 @@
import * as all from '../re-export-all-multiple/b'

// Don't do the the sum here to prevent treeshaking optimizations
output = all
10 changes: 10 additions & 0 deletions test/scope-hoisting.js
Expand Up @@ -112,6 +112,16 @@ describe('scope hoisting', function() {
assert.equal(output, 15);
});

it('supports importing all exports re-exported from multiple modules deep', async function() {
let b = await bundle(
__dirname +
'/integration/scope-hoisting/es6/import-multiple-wildcards/a.js'
);

let {foo, bar, baz, a, b: bb} = await run(b);
assert.equal(foo + bar + baz + a + bb, 15);
});

it('supports re-exporting all exports from multiple modules deep', async function() {
let b = await bundle(
__dirname + '/integration/scope-hoisting/es6/re-export-multiple/a.js'
Expand Down

0 comments on commit 23ee7c2

Please sign in to comment.