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

Fix 'does not export default' error with scope hoisting and url/worklet pipeline #6803

Merged
merged 4 commits into from
Sep 1, 2021

Conversation

devongovett
Copy link
Member

When referencing a JavaScript file with the url: or worklet: pipeline, and that JS file has ESM imports or exports, you would get a does not export default error in symbol propagation. This is because the symbols get set by the JS transformer when there is ESM, and when there are no imports or exports, * gets added.

In this PR I added a fake * symbol by default when the url: or worklet: pipelines are used to avoid this. Alternatively, we could check if asset.bundleBehavior === 'isolated' in symbol propagation perhaps. @mischnic what do you think?

@height
Copy link

height bot commented Aug 29, 2021

Link Height tasks by mentioning a task ID in the pull request title or description, commit messages, or comments.

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@parcel-benchmark
Copy link

parcel-benchmark commented Aug 29, 2021

Benchmark Results

Kitchen Sink ✅

Timings

Description Time Difference
Cold 1.98s +50.00ms
Cached 296.00ms -1.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 600.00ms -36.00ms 🚀
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 601.00ms -35.00ms 🚀
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 600.00ms -36.00ms 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 631.00ms +547.00ms ⚠️
dist/legacy/parcel.7cdb0fad.webp 102.94kb +0.00b 632.00ms +547.00ms ⚠️
dist/modern/parcel.7cdb0fad.webp 102.94kb +0.00b 633.00ms +549.00ms ⚠️
dist/legacy/index.html 775.00b +0.00b 1.15s +108.00ms ⚠️
dist/modern/index.html 715.00b +0.00b 1.15s +108.00ms ⚠️

React HackerNews ✅

Timings

Description Time Difference
Cold 10.15s -114.00ms
Cached 505.00ms +37.00ms ⚠️

Cold Bundles

No bundle changes detected.

Cached Bundles

Bundle Size Difference Time Difference
dist/logo.c5bb83f1.png 246.00b +0.00b 4.91s -582.00ms 🚀

AtlasKit Editor ✅

Timings

Description Time Difference
Cold 1.15m -373.00ms
Cached 1.73s +102.00ms ⚠️

Cold Bundles

Bundle Size Difference Time Difference
dist/index.66685265.js 1.77mb +6.00b ⚠️ 19.69s -138.00ms
dist/index.7415b9c9.js 694.58kb +15.00b ⚠️ 39.29s -14.28s 🚀
dist/editorView.a4ee0b14.js 594.90kb +0.00b 39.29s -13.72s 🚀
dist/popup.a56dbcab.js 209.65kb +0.00b 39.29s -13.72s 🚀
dist/EmojiPickerComponent.4860db5a.js 146.66kb +0.00b 21.41s -11.53s 🚀
dist/index.ee0c0284.js 145.42kb +0.00b 39.29s -14.27s 🚀
dist/Toolbar.a52a7ea2.js 107.22kb +0.00b 39.29s -13.72s 🚀
dist/card.1a06c3c9.js 62.65kb +0.00b 39.29s -14.27s 🚀
dist/Modal.6cee82fe.js 45.31kb -15.00b 🚀 39.30s -13.72s 🚀
dist/esm.1a898650.js 33.13kb +0.00b 21.41s -11.53s 🚀
dist/DatePicker.fd161f0b.js 22.96kb +0.00b 21.41s -11.53s 🚀
dist/js.0f0bb621.js 17.24kb +0.00b 39.29s -13.71s 🚀
dist/ui.c02e8854.js 14.93kb +0.00b 39.30s -13.72s 🚀
dist/smartMediaEditor.299f6284.js 13.24kb +0.00b 39.29s -13.72s 🚀
dist/dropzone.0d183115.js 12.13kb +0.00b 39.29s -13.72s 🚀
dist/card.45f850d6.js 5.75kb +0.00b 39.29s -14.27s 🚀
dist/EmojiPickerComponent.55e0a64c.js 3.71kb +0.00b 39.30s -13.72s 🚀
dist/png-chunks-extract.94b5b9fc.js 3.56kb +0.00b 39.29s -13.71s 🚀
dist/dropzone.cf53fd41.js 3.28kb +0.00b 39.29s -13.72s 🚀
dist/Modal.7f4c60b3.js 3.13kb +0.00b 39.29s -14.28s 🚀
dist/clipboard.e235bbd0.js 2.92kb +0.00b 39.29s -13.72s 🚀
dist/ResourcedEmojiComponent.78f6ddfc.js 2.10kb +0.00b 39.30s -13.72s 🚀
dist/feedback.e18b45f0.js 1.75kb +0.00b 21.41s -11.53s 🚀
dist/browser.09200cd5.js 1.68kb +0.00b 39.29s -13.72s 🚀
dist/workerHasher.567cfc57.js 1.62kb +0.00b 21.41s -11.53s 🚀
dist/heading6.b3b946d1.js 1.49kb +0.00b 21.41s -11.53s 🚀
dist/heading5.e617db66.js 1.37kb +0.00b 21.41s -11.53s 🚀
dist/expand.1f17de7f.js 1.27kb +0.00b 21.41s -11.53s 🚀
dist/media-card-analytics-error-boundary.75fac461.js 1.10kb +0.00b 39.29s -13.72s 🚀
dist/media-picker-analytics-error-boundary.1602c912.js 949.00b +0.00b 39.29s -13.72s 🚀
dist/media-card-analytics-error-boundary.b1a780f3.js 945.00b +0.00b 39.29s -14.27s 🚀
dist/simpleHasher.2a6e12b6.js 626.00b +0.00b 39.30s -13.71s 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/index.4d7d7586.js 1.77mb -4.00b 🚀 19.47s -774.00ms
dist/Modal.d95df922.js 45.31kb -15.00b 🚀 52.57s -1.25s

Three.js ✅

Timings

Description Time Difference
Cold 7.18s -97.00ms
Cached 384.00ms -20.00ms 🚀

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

@mischnic
Copy link
Member

Alternatively, we could check if asset.bundleBehavior === 'isolated' in symbol propagation perhaps.

Does "isolated" always mean that the imported value will be the bundle URL and not the actual exports of the asset? If that's the case, then we should use that as the condition in symbol propagation.

@devongovett
Copy link
Member Author

Technically it's up to the bundler/runtime what happens. Isolated means a separate bundle will be created, and the JS runtime inserts a URL if a non-async dependency resolved to a bundle.

@devongovett
Copy link
Member Author

Ok updated to use bundleBehavior instead. Also realized that it was broken for inline bundles as well, so added a test for that too.

@devongovett devongovett merged commit 8024612 into v2 Sep 1, 2021
@devongovett devongovett deleted the url-error branch September 1, 2021 16:22
lettertwo added a commit that referenced this pull request Sep 10, 2021
* v2: (69 commits)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  Fix add directoryExists function to matchFiles call. (#6784)
  Upgrade to Flow 158 (#6763)
  Revert "added cio headers (#6404)" (#6789)
  Process CSS in SVGs (#6743)
  ...
lettertwo added a commit that referenced this pull request Sep 10, 2021
* v2: (38 commits)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  Fix add directoryExists function to matchFiles call. (#6784)
  Upgrade to Flow 158 (#6763)
  Revert "added cio headers (#6404)" (#6789)
  Process CSS in SVGs (#6743)
  ...
lettertwo added a commit that referenced this pull request Sep 11, 2021
* bdo/number-edgetypes: (70 commits)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  Fix add directoryExists function to matchFiles call. (#6784)
  Upgrade to Flow 158 (#6763)
  Revert "added cio headers (#6404)" (#6789)
  Process CSS in SVGs (#6743)
  ...
lettertwo added a commit that referenced this pull request Sep 13, 2021
* v2: (38 commits)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  Fix add directoryExists function to matchFiles call. (#6784)
  Upgrade to Flow 158 (#6763)
  Revert "added cio headers (#6404)" (#6789)
  Process CSS in SVGs (#6743)
  ...
lettertwo added a commit that referenced this pull request Sep 13, 2021
* bdo/number-edgetypes: (70 commits)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  Fix add directoryExists function to matchFiles call. (#6784)
  Upgrade to Flow 158 (#6763)
  Revert "added cio headers (#6404)" (#6789)
  Process CSS in SVGs (#6743)
  ...
lettertwo added a commit that referenced this pull request Sep 13, 2021
* v2: (42 commits)
  Remove dead link to docs in diagnostic (#6913)
  Fix engines.parcel in SVG packager (#6911)
  Use imported Readable flow type instead of global (#6910)
  Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  ...
lettertwo added a commit that referenced this pull request Sep 13, 2021
* v2: (42 commits)
  Remove dead link to docs in diagnostic (#6913)
  Fix engines.parcel in SVG packager (#6911)
  Use imported Readable flow type instead of global (#6910)
  Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  ...
lettertwo added a commit that referenced this pull request Sep 13, 2021
* bdo/number-edgetypes: (74 commits)
  Remove dead link to docs in diagnostic (#6913)
  Fix engines.parcel in SVG packager (#6911)
  Use imported Readable flow type instead of global (#6910)
  Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785)
  Use yarnpkg registry for all the things (#6908)
  Fix issue about loading configs from tsconfig.json (#6881)
  Add `@section` to Compressor type (#6885)
  Parcel API improvements (#6866)
  Use stream-browserify for polyfilling instead (#6863)
  Add support for compressor plugins (#6776)
  Support for inline style attributes and inline scripts in SVG (#6797)
  Bump less (#6852)
  Make sure (non-React) SVGs are in separate bundles (#6757)
  Add support for injecting manifest into service workers (#6798)
  Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803)
  Remaining cargo clippy fixes (#6829)
  Lazily install sharp only when needed (#6816)
  More cargo clippy suggestions (#6811)
  Don't emit runtime manifest for inline child bundles (#6807)
  Apply suggestions from rust-clippy (#6256)
  ...
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.

3 participants