Preact-cli: --service-worker=false still generates service worker

Created on 23 Oct 2017  路  5Comments  路  Source: preactjs/preact-cli

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

What is the current behavior?
A sw.js file is still generated when --service-worker=false is passed.

If the current behavior is a bug, please provide the steps to reproduce.
Run build with --service-worker=false

What is the expected behavior?
A sw.js file will not be generated.

Please mention other relevant information.

  • node version
    v8.7.0
  • npm version
    v5.4.2
  • Operating system
    Ubuntu 17.10

Most helpful comment

Correct. It will still create the sw.js file but it will not be attached to the app. @joshuataylor Your suggestion would need to fall under a new flag since there's a difference between "I don't need a SW" vs "I need to remove all past SWs" 馃憤

All 5 comments

yeah currently the way it works is it simply does not register it anymore. but yes this can be improved

Honestly, it should create one but unregister. Serviceworkers are great, found this during my testing before :).

Correct. It will still create the sw.js file but it will not be attached to the app. @joshuataylor Your suggestion would need to fall under a new flag since there's a difference between "I don't need a SW" vs "I need to remove all past SWs" 馃憤

@developit any thoughts on how to handle this?

We can check if we get env args in webpack config, then we can stop emitting the sw

Was this page helpful?
0 / 5 - 0 ratings