new-new-new Service worker not registering
See original GitHub issueAfter a choojs/bankai#new-new-new build
, in which the app.use(require('choo-service-worker')())
is uncommented and set NODE_ENV=production
, the service worker does not register.
I can confirm however that the bundle.js file built by bankai does have
navigator.serviceWorker.register
If I register the serviceWorker in the index.html, rather than bundle.js then the serviceWorker registers.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Service Worker not registering · Issue #171 · BuilderIO/partytown
I am trying to try a POC around Partytown, but i am not able to get it working. Getting the following error.
Read more >service worker register is not registering - Stack Overflow
I am trying to register service worker in my application. but its not being register. Code https://github.com/faisalmjanjua/PWATesting.git.
Read more >Does not register a service worker that controls page and ...
Registering a service worker is the first step towards enabling key Progressive Web App (PWA) features: Works offline; Supports push ...
Read more >ServiceWorkerContainer.register() - Web APIs | MDN
A string indicating how the HTTP cache is used for service worker scripts resources during updates. Note: This only refers to the service...
Read more >Service Workers - W3C
7.1 Define API bound to Service Worker Registration ... execution lifetime of events and not references held by service worker clients to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the technical reason is that if no service worker file is found, bankai uses an empty Buffer instead as the input for the service worker node in the graph it uses to build things. But we could add a check in
lib/cmd-build.js
so that empty service worker files are not writtenbankai looks for
sw.js
andservice-worker.js
files in your own source and uses whichever it finds first. If you want to use some service worker implementation from npm you can create a local service worker file that only requires the one from npm:AFAIK the sw.js in choo-service-worker is only an example and not intended to be used in this way though
Yep, that seems to work! Brilliant!
Probably need to update create-choo-app