-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A registered service worker breaks development #2272
Comments
I can’t seem to reproduce this so far. |
Ah, @Timer says he uses 5000 as DEV port (which is default PROD port). |
Having Will send a PR. |
Unwanted service workers taking control due to sharing ports between environments can definitely be an issue. It's really a good idea not to mix ports across environments if at all possible, but obviously developers might do that. The problem with writing conditional code that refers to The best way of dealing with this would be to create a no-op service worker that will be checked in to the development source, and that would be overwritten by the production service worker when a build is done. This no-op service worker will end up being fetched from the development web server in the scenario you describe, and then the next visit to the development page will behave as if there were no service worker present. I'm happy to file a PR for this after confirming that there are no unexpected side effects locally. |
If you happen to run
serve -s build
and it installs a localhost service worker, all future development is borked (no page reloading).We need to fix this problem... do we need to add something like this?
I believe the docs mention this, but it's super annoying.
/cc @jeffposnick
The text was updated successfully, but these errors were encountered: