Skip to content
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

bug: Service worker registration not working in react #22861

Closed
satheshsat opened this issue Feb 3, 2021 · 2 comments
Closed

bug: Service worker registration not working in react #22861

satheshsat opened this issue Feb 3, 2021 · 2 comments
Labels

Comments

@satheshsat
Copy link

Bug Report

Ionic version:
[x] 5.x

Current behavior:
Try to register service worker file ( service-worker.js ) from root path. But there is no such a file in build.

Expected behavior:
Need to register service worker for PWA

Steps to reproduce:
ionic start pwa blank --type=react
change serviceWorker.unregister(); to serviceWorker.register(); in index.tsx
ionic build --prod
npx serve build
Service worker can't be registered in local. But it runs service worker validation.
console: GET http://localhost:5000/service-worker.js 404 (Not Found)

@ionitron-bot ionitron-bot bot added the triage label Feb 3, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. There were some changes in how react-scripts v4 generated PWA-related files that caused this to no longer work. We have updated our starters to properly generate the service worker file now.

@ionitron-bot
Copy link

ionitron-bot bot commented Mar 6, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants