-
-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Allow worker to use plugins #39
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
Conversation
This PR maintains the same API, but I strongly recommend we switch the rest of the implementation to fall in line with worker-plugin as it also keeps the default |
|
I've tried this out and it looks like it works pretty well. However, it seems to be bundling my entire code base into the worker script, rather than only using the code that I import in the worker script itself. Any insight on how to further configure this so that I don't end up double deploying an entire project's worth of code? As a side note, I've recently needed to implement multithreading in my application and I am astounded that I can't reuse code by default across the Angular and Web Worker sides of my app. This really needs to be addressed to make multithreading viable in my (and I'm guessing many others') use cases. |
…into worker-plugins
I suggest isolating the shared code (create shared files that are imported in both the worker and app don't have references to other parts of the app). My guess is that tree-shaking in the worker isn't perfect, so you get a lot of stuff broken into small files instead of a big chunk. Using workers already bundles almost 1MB of mostly unused JS code. Maybe there's a way to spawn the child webpack process without splitting or with a better tree-shaking. Also, try using |
Awesome, thanks! It turns out I was using a static property on a class that was decorated by and Angular decorator and a few other dependencies, so that's what brought in so many of my files. Removing that cut it in about half. It is still annoying to have so much code duplicated in the form of libraries (I have one major dependency that I need in both threads) but I'm not sure that can be helped, and I haven't tried minifying yet. |
LGTM! Thanks @edusperoni About the switching the rest of the implementation, so that we can support the default I think the best course of action is to merge this PR now and work on |
Hey @vcooley and @edusperoni So, I'm thinking that we may introduce a |
@vakrilov I think it's a great idea! The worker bundle size has bothered me in the past. Maybe this could be further expanded into breaking each polyfill down to multiple files so we have:
So in the end the developer can just |
This PR allows the worker to use inherited and custom plugins.
Based on worker-plugin.
Fixes #23