Build lightning fast Progressive Web Apps with zero config and best practices built-in. Go from zero to production ready with Ionic and Stencil (Web Components).
MIT License
635
stars
74
forks
source link
Disappearing sw.js file and service worker in browser #57
Current behavior:
I'm not sure if I am misunderstanding something in the newest PWA toolkit, but sometimes when I run "npm run devWithSW" it deletes the sw.js file from the build and there is no service worker loaded in the browser. To get the sw.js back, I have to re-build ("npm run build"). But, after I rebuild and run "npm run devWithSW", it deletes the sw.js again.
Here is the sw.js in the www folder after build:
Note the sw.js is gone from the www folder after "npm run devWithSW":
Note that there is no service worker in the browser after "npm run devWithSW":
Expected behavior:
I expect the sw.js to be there everytime after running "npm run devWithSW" so that a service worker is properly loaded in the browser.
Steps to reproduce:
Using Visual Code for the Ionic PWA Toolkit, run build. Note the sw.js file in the build folder (www). Now, run devWithSW and note how the sw.js is deleted and that there is no service worker loaded in the browser. This does not occur eveytime, but enough times where you should be able to replicate it after a few tries.
Resources: Before submitting an issue, please consult our docs.
Stencil version: (run
npm list @stencil/core
from a terminal/cmd prompt and paste output below):I'm submitting a ... (check one with "x") [ X] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://stencil-worldwide.slack.com
Current behavior: I'm not sure if I am misunderstanding something in the newest PWA toolkit, but sometimes when I run "npm run devWithSW" it deletes the sw.js file from the build and there is no service worker loaded in the browser. To get the sw.js back, I have to re-build ("npm run build"). But, after I rebuild and run "npm run devWithSW", it deletes the sw.js again.
Here is the sw.js in the www folder after build:
Note the sw.js is gone from the www folder after "npm run devWithSW":
Note that there is no service worker in the browser after "npm run devWithSW":
Expected behavior: I expect the sw.js to be there everytime after running "npm run devWithSW" so that a service worker is properly loaded in the browser.
Steps to reproduce: Using Visual Code for the Ionic PWA Toolkit, run build. Note the sw.js file in the build folder (www). Now, run devWithSW and note how the sw.js is deleted and that there is no service worker loaded in the browser. This does not occur eveytime, but enough times where you should be able to replicate it after a few tries.
Related code:
Other information: