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

Don't retarget dependencies with * #8645

Merged
merged 2 commits into from
Nov 27, 2022
Merged

Conversation

mischnic
Copy link
Member

@mischnic mischnic commented Nov 19, 2022

Fixes #8624

It doesn't really make sense to do retargeting if the dependency has a used * symbols, because the retargeting won't enable any benefits in that case (apart from potentially even more code being generated).

Furthermore, that fixes a bug where a dependency with symbols * -> * was split into two (one for the used * and one for a specific symbol itself) which really confused this code:

// If the resolved asset has an exports object, use the $parcel$exportWildcard helper
// to re-export all symbols. Otherwise, if there's no namespace object available, add
// $parcel$export calls for each used symbol of the dependency.
if (
isWrapped ||
resolved.meta.staticExports === false ||
nullthrows(this.bundleGraph.getUsedSymbols(resolved)).has('*') ||
// an empty asset
(!resolved.meta.hasCJSExports &&
resolved.symbols.hasExportSymbol('*'))
) {
let obj = this.getSymbolResolution(asset, resolved, '*', dep);
append += `$parcel$exportWildcard($${assetId}$exports, ${obj});\n`;
this.usedHelpers.add('$parcel$exportWildcard');
} else {
for (let symbol of nullthrows(
this.bundleGraph.getUsedSymbols(dep),
)) {

@parcel-benchmark
Copy link

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.53s -48.00ms
Cached 364.00ms +16.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 93.00ms +10.00ms ⚠️
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 94.00ms +10.00ms ⚠️
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 93.00ms +9.00ms ⚠️
dist/modern/index.31cedca9.css 94.00b +0.00b 267.00ms +14.00ms ⚠️

Cached Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 90.00ms +9.00ms ⚠️
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 91.00ms +9.00ms ⚠️
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 90.00ms +7.00ms ⚠️
dist/legacy/index.html 826.00b +0.00b 573.00ms +34.00ms ⚠️
dist/modern/index.html 749.00b +0.00b 573.00ms +34.00ms ⚠️
dist/legacy/index.b8ae99ba.css 94.00b +0.00b 270.00ms +21.00ms ⚠️
dist/modern/index.31cedca9.css 94.00b +0.00b 270.00ms +21.00ms ⚠️

React HackerNews ✅

Timings

Description Time Difference
Cold 9.84s +313.00ms
Cached 448.00ms -21.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.77m +1.55s
Cached 2.24s -179.00ms 🚀

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Three.js ✅

Timings

Description Time Difference
Cold 6.80s -208.00ms
Cached 292.00ms +22.00ms ⚠️

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@mischnic mischnic merged commit 143b773 into v2 Nov 27, 2022
@mischnic mischnic deleted the 8624-dep-splitting-namespace branch November 27, 2022 12:28
lettertwo added a commit that referenced this pull request Dec 8, 2022
* upstream/v2:
  Make sure we're compiling on ubuntu-20.04
  v2.8.1
  Add mjs and cjs to resolver extensions (#8667)
  Fix transformer-svg-react not finding .svgrrc's (#7741)
  Fix overriding single export of a `export *` (#8653)
  chore: spelling fix (#8614)
  Parse shortcut icons in web app manifests (#8660)
  Make ts-types transformer work with TS >= 4.8 (#8661)
  Don't retarget dependencies with `*` (#8645)
  fix: remove @parcel/utils dep in @parcel/graph (#8630)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: parcel@2.8.0 build keeps undefined $08c370c820b39c31$exports for ESM
3 participants