-
Notifications
You must be signed in to change notification settings - Fork 831
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
[v5-alpha] workbox-build does not bundle workbox-* packages with rollup #2106
Comments
Thanks for reporting this. I'm taking a look now. The intended behavior is for workbox/packages/workbox-build/src/lib/module-registry.js Lines 22 to 23 in 9a4b382
|
Okay, I think I see what's happening: when you use I'll clean up that logic. Thanks for reporting it! |
Thanks for the debugging and proposed solution, @kaykayehnn! I tested out your change and it looks good:
The one slightly messy part is that there's a unit test that needs to be updated to work with this new approach. We use If you wanted to open a PR against the |
Fixed in #2110 |
Library Affected:
workbox-build
Browser & Platform:
all browsers, tested on macOS and Windows
Issue or Feature Request Description:
In v5 alpha, when workbox-build generates a service worker, it saves it to a temporary directory on the file system in order to pass it to rollup for bundling. The temporary directory only contains
sw.js
and rollup cannot resolve the imports toworkbox-*
packages, so it assumes they are external dependencies and leaves them as rawdefine
calls.Expected behaviour
Workbox-build generates a bundle containing the service worker and its dependencies.
Actual behaviour
Workbox-build generates a bundle containing raw define calls to dependent packages.
Minimal reproducible repo
kaykayehnn/workbox-build-node-resolution-bug
Notes
rollup-plugin-node-resolve, which is used to resolve imports in the service worker bundle, has an option to provide a base directory for resolutions. Setting it to the project root should fix this issue.
I can make a PR for this if that's okay.
The text was updated successfully, but these errors were encountered: