Skip to content

Commit 23ee7c2

Browse files
fathybdevongovett
authored andcommitted
Fix import deep wildcards with tree-shaking (#1681)
1 parent ec3aea9 commit 23ee7c2

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

ā€Žsrc/scope-hoisting/concat.jsā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = (packager, ast) => {
5656
// If this module exports wildcards, resolve the original module.
5757
// Default exports are excluded from wildcard exports.
5858
let wildcards = module && module.cacheData.wildcards;
59-
if (wildcards && name !== 'default') {
59+
if (wildcards && name !== 'default' && name !== '*') {
6060
for (let source of wildcards) {
6161
let m = findExportModule(resolveModule(id, source).id, name);
6262
if (m.identifier) {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as all from '../re-export-all-multiple/b'
2+
3+
// Don't do the the sum here to prevent treeshaking optimizations
4+
output = all

ā€Žtest/scope-hoisting.jsā€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ describe('scope hoisting', function() {
112112
assert.equal(output, 15);
113113
});
114114

115+
it('supports importing all exports re-exported from multiple modules deep', async function() {
116+
let b = await bundle(
117+
__dirname +
118+
'/integration/scope-hoisting/es6/import-multiple-wildcards/a.js'
119+
);
120+
121+
let {foo, bar, baz, a, b: bb} = await run(b);
122+
assert.equal(foo + bar + baz + a + bb, 15);
123+
});
124+
115125
it('supports re-exporting all exports from multiple modules deep', async function() {
116126
let b = await bundle(
117127
__dirname + '/integration/scope-hoisting/es6/re-export-multiple/a.js'

0 commit comments

Comments
Ā (0)
⚔