Preact-cli: Is --no-service-worker now --sw=false?

Created on 16 May 2019  路  4Comments  路  Source: preactjs/preact-cli


Do you want to request a _feature_ or report a _bug_?

I believe it's a bug.

What is the current behaviour?

Previous to v3 we were using --no-service-worker which seemed to work fine. After upgrading to 3.0.0-rc.1 I noticed errors in the console about sw.js and upon investigation noticed the service worker was still referenced in the bundle. I tried --sw=false after looking at the source, that seems to work. Should the documentation be updated?

If the current behaviour is a bug, please provide the steps to reproduce.

Try using --no-service-worker

What is the expected behaviour?

No service worker is injected.

Please mention other relevant information.

  • Node version: 11.14.0
  • npm version: 6.9.0
  • Operating system: MacOS 10.14.5
  • CLI version: 3.0.0-rc.1
  • Browser: Firefox
question

All 4 comments

do you see a sw generated in the build folder after using --no-service-worker?

The --service-worker flag got renamed to --sw: https://github.com/developit/preact-cli/blob/e4ca195a8a6e515eb5e5a385928bf345703c1fda/packages/cli/lib/index.js#L38

Both --no-sw and --sw=false should disable SWs

gosh.. yes just checked it... now thinking was the earlier name better?

IMO sw is better, especially since it's also our ENV var. IIRC it was also the consensus in slack at at time. Doesn't really matter to me though

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nephix picture nephix  路  4Comments

c0debreaker picture c0debreaker  路  4Comments

jpoo90 picture jpoo90  路  4Comments

raphaelbauer picture raphaelbauer  路  3Comments

AlStar01 picture AlStar01  路  3Comments