-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 worker bundle hoisting #1257
Conversation
src/Bundler.js
Outdated
@@ -532,7 +538,7 @@ class Bundler extends EventEmitter { | |||
bundle = Bundle.createWithAsset(asset); | |||
} else if (dep && dep.dynamic) { | |||
// Create a new bundle for dynamic imports | |||
bundle = bundle.createChildBundle(asset); | |||
bundle = bundle.createChildBundle(asset, dep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the magical line that will allow me to
import { debounce } from 'lodash';
...in my web workers? We're very keen on being able to bundle external assets in our webworker scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR should fix it
Thanks for your great work on parcel @DeMoorJasper I have tested the branch import throttle from "lodash.throttle"; Am I missing something ? |
@sebastiencs that's strange could you create a minimal example repo to reproduce that? This branch is far behind on the recent parcel version though, so it might actually have been fixed in the master if it's unrelated to this. |
@DeMoorJasper Turns out that if I change my worker filename from |
3d90e3f
to
2530b43
Compare
…ed in the worker bundle.
2530b43
to
9ec7023
Compare
This is a branched of PR from #979
Main difference is that this PR adds options to the bundle that sets bundle.isolated, instead of looping through all dependencies every time you add a new one. (Should be slightly faster and more straightforward)
All credit goes to @dhcode for this, just wanted to bring some new life into this issue.
Closes #979