-
Notifications
You must be signed in to change notification settings - Fork 799
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
Have injectManifest work directly on file #2303
Comments
For historical reasons, we maintain a "first-party" We're not doing the same for Rollup, but someone from the community has created https://www.npmjs.com/package/rollup-plugin-workbox Using either the webpack or the Rollup plugin is a viable approach for anyone who wants to do both compilation + manifest injection in the same step, and it's now easier to split them in two steps without needing to create a temporary file, following #2231. So, in general, this should be addressed in v5. Let me know if you feel differently. |
Thanks for the update Jeff. I'd like to reopen this as, currently written, the Rollup Plugin calls I think, given the way v5 is built, it's certainly possible to construct a Rollup plugin that would work without reading and writing a file by forking the |
For a little bit of background into doing this as a Rollup plugin, Rollup can provide both a string and a sourcemap, so I'd love to be able to have |
If you want to mimic That should be callable from within a Rollup plugin, and taking that return value and doing a string replacement of The core Workbox team doesn't have any plans to maintain a Rollup plugin, but perhaps working with the folks behind https://www.npmjs.com/package/rollup-plugin-workbox to add in that functionality would make sense? |
Makes sense to me. That's basically what I'm prototyping right now. |
@Snugug I am working on the same problem right now. Do you have already any solution that you can share with us? |
I do in fact!
https://www.npmjs.com/package/rollup-plugin-workbox-inject
It is meant for Workbox 5 but it works as I described!
… On Jan 22, 2020, at 5:20 AM, karabaesh ***@***.***> wrote:
@Snugug I am working on the same problem right now. Do you have already any solution that you can share with us?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Welcome! Please use this template for reporting bugs or requesting features. For questions about using Workbox, the best place to ask is Stack Overflow, tagged with
[workbox]
: https://stackoverflow.com/questions/ask?tags=workboxLibrary Affected:
workbox-build
Browser & Platform:
all OSes
Issue or Feature Request Description:
One struggle I'm running into with using Workbox with a JS bundler (in my case Rollup) is that it doesn't play nicely in the JS bundler ecosystem. Specifically, if I want to use
injectManifest
, I need to give over control over to Workbox instead of working acting as a plugin manipulating the files already being worked on in the bundler. The net result of this is that if I want to use bothinjectManifest
and compile my service worker through a bundler, there's an intermediate step where my compiled SW must be written to disk.What I'd like to see is the ability for
injectManifest
to either take in an AST or a string and be able to export either a string or an AST instead of reading and writing files directly, thus allowing bundlers like Rollup and Webpack to have plugins that are able to fully interact with the rest of their ecosystems.The text was updated successfully, but these errors were encountered: