Preact-cli: Modifying the service worker registration code

Created on 13 Jun 2018  路  2Comments  路  Source: preactjs/preact-cli

Do you want to request a feature or report a bug?
Feature

What is the current behaviour?
Can't modify the service worker registration code

If this is a feature request, what is motivation or use case for changing the behaviour?
I would like to switch to a more comprehensive registration. Eg. https://github.com/GoogleChromeLabs/sw-precache/blob/5699e5d049235ef0f668e8e2aa3bf2646ba3872f/demo/app/js/service-worker-registration.js

Is that possible?

Most helpful comment

That should work! Thanks @prateekbh for that ultra-quick response :)

Edit:
Suggestion: May be instead of inlining the registration code, we can import a module which when required can be overridden by providing another module from preact.config.js or somewhere.

All 2 comments

Yes! but then you'll have to build the service worker yourself too.

--no-service-worker will switch off everything(building + registeration) related to sw from our side.

That should work! Thanks @prateekbh for that ultra-quick response :)

Edit:
Suggestion: May be instead of inlining the registration code, we can import a module which when required can be overridden by providing another module from preact.config.js or somewhere.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpoo90 picture jpoo90  路  4Comments

thangngoc89 picture thangngoc89  路  3Comments

oren picture oren  路  3Comments

haggen picture haggen  路  3Comments

hardcoar picture hardcoar  路  3Comments