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

Worker bug fixes #6582

Merged
merged 8 commits into from
Jul 12, 2021
Merged

Worker bug fixes #6582

merged 8 commits into from
Jul 12, 2021

Conversation

devongovett
Copy link
Member

@devongovett devongovett commented Jul 11, 2021

Fixes #6579. Fixes #5503. Fixes #5504. Fixes #5920. Fixes #5864. Fixes #6562. Fixes T-1102. Fixes T-1101.

  • Fixes dynamic imports in workers with old browser targets. The runtime calls importScripts which would previously error for modules.
  • Fixes import being renamed to _import by SWC for very old browser targets (ES3 reserved words pass).
  • Relaxes importScripts error so it doesn't occur outside a worker context, or when passed a variable rather than a string literal (only allowed in script workers).
  • Fixes workers that reference themselves, i.e. new Worker('current-filename'). This was a bug in bundling that caused the asset to be erroneously internalized due to the cycle.
  • Disables shared bundles between different contexts, i.e. between the page and worker. This caused breakages because the wrong loaders could be added, and transformers might depend on the environment context. This will need to be revisited at some point.

@height
Copy link

height bot commented Jul 11, 2021

This pull request has been linked to and will mark 2 tasks as "Done" when merged:

@parcel-benchmark
Copy link

parcel-benchmark commented Jul 11, 2021

Benchmark Results

Kitchen Sink 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

React HackerNews ✅

Timings

Description Time Difference
Cold 8.43s +170.00ms
Cached 410.00ms -12.00ms

Cold Bundles

Bundle Size Difference Time Difference
dist/logo.1e014c76.png 274.00b +0.00b 196.00ms -13.00ms 🚀

Cached Bundles

Bundle Size Difference Time Difference
dist/logo.1e014c76.png 274.00b +0.00b 209.00ms +20.00ms ⚠️

AtlasKit Editor 🚨

Timings

Description Time Difference
Cold FAILED -0.00ms
Cached FAILED -0.00ms

Cold Bundles

No bundles found, this is probably a failed build...

Cached Bundles

No bundles found, this is probably a failed build...

Three.js ✅

Timings

Description Time Difference
Cold 5.90s -126.00ms
Cached 355.00ms -0.00ms

Cold Bundles

No bundle changes detected.

Cached Bundles

No bundle changes detected.

Click here to view a detailed benchmark overview.

let lodashSibling = path.basename(
b.getBundles().find(v => v.getEntryAssets().length === 0).filePath,
);
// let lodashSibling = path.basename(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug? or should this be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it in case we bring back shared bundles between page and worker...

@devongovett devongovett merged commit b549b1d into v2 Jul 12, 2021
@devongovett devongovett deleted the worker-fixes branch July 12, 2021 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment