-
Notifications
You must be signed in to change notification settings - Fork 363
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
feat(web-workers): Add rollup-plugin-web-worker-loader #757
Conversation
|
Thanks for the comprehensive PR. I'm a fan of using workers and making worker usage easier. That said, I'm not sure a prefix is the right direction for Microbundle to take. It's specific to A syntax detection-based approach like that of rollup-plugin-off-main-thread or rollup-plugin-worker would get around this concern. Ultimately, I think it might make more sense to land support for the general-purpose Thoughts? |
Thank You for Your review and feedback, Jason! I'm currently engaged in other projects, but will (re)evaluate this PR/funcionality some time in the future. Unless someone is faster 😃. Would like to give You an ETA, but my timeline is too messy currently. |
Targets enhancement: #170 Enable usage of `microbundle --worker-loader` to apply rollup-plugin-web-worker-loader.
and set `external: []` in the plugin options to instruct rollup to inline all external dependencies to the worker blob.
Inline sourcemaps into worker blobs only if sourcemaps are enabled (default) and compression is disabled (non-default).
Hello! Yeah, I did follow up on these events recently. But as I needed this specific feature/plugin (to bundle workes inline within my library), I went ahead and monkey-patched .. sorry that I was of no further assistance when it came to implementing/merging the alternative implementation. |
What this pull request does
This pull request aims at providing a convenient way to create inlined JavaScript source blobs which contain all dependencies to run within a WebWorker execution context.
What this pull request contains
npm run microbundle
)Further notes
I've tried to adhere to the standards of the codebase and the resulting changes can successfully build the rollup-typescript-webworkers repository, which is an example how to use the rollup-plugin-web-worker-loader. Feel free to point me in the right direction if You consider to merge this, but need some changes to be done! :)
Issues/drawbacks
In order to successfully use the rollup-plugin-web-worker-loader, I had to disable the Rollup build cache when running microbundle with the plugin enabled (see here). This seems to be related to an incompatibility between this plugin and something else. I've tried to investigate further, but dropped the lead after spending to much time digging through the Rollup internals. As for now, the behavior of microbundle/Rollup build cache does not change, when building without this feature.