Service worker improvements
See original GitHub issueDo you want to request a feature or report a bug? Feature
What is the current behavior? To make additions in service worker, users currently have to
- copy paste the whole sw.js in their
src
folder. - find apt place to make the change according to their need
- make changes amid the 70 lines of code that we have.
What is the expected behavior?
- Ugly details of basic service worker setup should be hidden from the users.
- Users should be able to import a prebuilt module e.g.
preact/sw
and initialize it in < 5 LOC. - Advanced users should be able to add functionality on a clean stale environment
If this is a feature request, what is motivation or use case for changing the behaviour? We want to abstract away the basic service worker setup in a module and make improvements to it while users can customize additional functionality on top of it.
Currently the option users have for modifications in sw.js
is to copy the entire thing and make changes to it. This makes us loose all control over their service worker for future releases.
P.S: We don’t want to maintain a full fledged SW library. We just want to govern basic setup and be able to ship improvements/library changes to all the basic users without a breaking change in preact-cli. However, this means that it might still be a breaking change for some advanced users, who can pretty much eject from our sw
setup anyways.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:9 (8 by maintainers)
Top GitHub Comments
Yes these utilities can be shipped as inbuilt plugins as well
@harshitkumar31 sorry for taking this over. We can still use help with https://github.com/preactjs/preact-cli/pull/1049#issuecomment-601864284