Skip to content

Commit

Permalink
fix test regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
gorakong committed Mar 1, 2022
1 parent d9656ec commit 0f23e46
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/packagers/js/src/ScopeHoistingPackager.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,22 @@ ${code}
this.hoistedRequires.set(dep.id, hoisted);
}

hoisted.set(
resolvedAsset.id,
`var $${publicId} = parcelRequire(${JSON.stringify(publicId)});`,
let resolvedAssetUsedSymbols = nullthrows(
this.bundleGraph.getUsedSymbols(resolvedAsset),
);

if (
nullthrows(this.bundleGraph.getUsedSymbols(dep)).has(exportSymbol) ||
resolvedAssetUsedSymbols.has(exportSymbol) ||
(exportSymbol === 'default' &&
resolvedAssetUsedSymbols.has(exportSymbol)) ||
(exportSymbol === '*' && resolvedAssetUsedSymbols.size > 0)
) {
hoisted.set(
resolvedAsset.id,
`var $${publicId} = parcelRequire(${JSON.stringify(publicId)});`,
);
}
}

if (isWrapped) {
Expand Down

0 comments on commit 0f23e46

Please sign in to comment.