Service Worker required when disabled in dev
See original GitHub issueWhat is the current behaviour?
When running preact watch --sw false
it still tries to attach a service worker. preact watch
works fine which should default sw
to false (https://github.com/preactjs/preact-cli#preact-watch).
Steps to Reproduce
- Use a project without a
.\src\sw.js
- Run
preact watch --sw false
- See error
Build failed!
× ERROR Entry module not found: Error: Can’t resolve ‘.\src\sw.js’ in ‘.\src’ × ERROR InjectManifest: Entry module not found: Error: Can’t resolve ‘.\src\sw.js’ in ‘.\src’
What is the expected behaviour?
Build should succeed using same behavior as preact watch
which defaults sw
to false
Please mention any other relevant information I’m assuming it was introduced in https://github.com/preactjs/preact-cli/commit/9f9277be2ed50476147bae5567640b36740b4d38
Environment Info:
System: OS: Windows 10 10.0.19043 Binaries: Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1023.0), Chromium (93.0.961.47) npmPackages: preact: ^10.5.14 => 10.5.14 preact-cli: ^3.2.2 => 3.2.2 preact-render-to-string: ^5.1.19 => 5.1.19 preact-router: ^3.2.1 => 3.2.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
https://github.com/preactjs/preact-cli/blob/b3b6984a1d022ac3348784061bd8864f66f2d670/packages/cli/lib/lib/webpack/webpack-client-config.js#L41
Looks like we’re not converting the “false” into a boolean in watch mode as we do in build, just passing the string value through.
Will try to get a fix together here.
Sorry, I don’t understand. You can customize the config as-is: