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

importScriptsViaChunks not supported with InjectManifest #2647

Closed
Tomburgs opened this issue Oct 12, 2020 · 2 comments · Fixed by #2650
Closed

importScriptsViaChunks not supported with InjectManifest #2647

Tomburgs opened this issue Oct 12, 2020 · 2 comments · Fixed by #2650

Comments

@Tomburgs
Copy link

Library Affected:
workbox-webpack-plugin

Browser & Platform:
Node

Issue or Feature Request Description:
Hello, I was attempting to use the importScriptsViaChunks parameter on the InjectManifest constructor, but got the following error:

Please check your InjectManifest plugin configuration:
"importScriptsViaChunks" is not a supported parameter.

According to the documentation this should be possible, but perhaps this is just a documentation issue as the code doesn't seem to indicate any such functionality with InjectManifest?

@jeffposnick
Copy link
Contributor

Apologies, the JSDoc is in fact incorrect.

In InjectManifest mode, you should be able to just pull in any code you want added to your service worker via ES module imports, without having to use importScriptsViaChunks. webpack will compile your swSrc file and translate the ES module imports into the ready-to-use swDest file.

@Tomburgs
Copy link
Author

Thank you for your response, @jeffposnick.

My issue was that I wanted to pull in NextJS' build manifest file which is generated at compilation time, and I thought that it might've been possible with importScriptsViaChunks.

What I ended up doing was defining build id via webpack's DefinePlugin and calling importScripts inside the service worker file to get NextJS' build manifest definition. Can have a look here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants