-
-
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
ServiceWorker not built in 4.x (next) #9776
Comments
@zaneclaes I deployed it to netlify. Do you know how can I fix this issue without having a |
This does not only affect Steps to repro:
|
@Empty2k12 Yes, exact same problem here. When I start a new app with
The service worker is nowhere to be seen. 😢 Also the familiar section for registering the service worker in This is no longer there 👇
|
Actually, I think SW is replaced by |
The 4.0.0 changelog says:
But I think I need more information. When I make a fresh project, it doesn't create a service worker either with the normal template or with Is this an incomplete feature in 4.0.0? |
Turns out you need to create your own I haven't investigated this fully, so in the interim I just copy/pasted what CRA@3 was building and modified it to use the new manifest accessible from |
This is surprising, and disappointing (?). I loved using I really hope CRA doesn't drop the excellent ready-made service worker. 🥺 |
I believe that there are more complaints about forcing a service worker by default than not, but it is extremely simple to continue using serviceWorker.
|
So I think there is no way except for making a custom service worker |
It would be nice if there were a decent upgrade path, here. Or just a documented one. For those upgrading to In any case, my "fix" was to create a dummy app:
And copy over the relevant code:
As well as the initialization code in |
I can confirm @adueck's findings as well. These files are not in the base template at all. I am new to React and working to port a small microsite from Jekyll just to get a feel for things. The import in Maddening. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
not quite resolved |
Are there plans to re-include the ServiceWorker in 4.x onwards? @kivervinicius recommended using |
I tried these steps but it didn't work for me. Do I need to follow any more steps? |
CRA v4 moved the service worker out of the core and into a template. Incorporate the template into the app. facebook/create-react-app#9776
CRA v4 moved the service worker out of the core and into a template. Incorporate the template into the app. facebook/create-react-app#9776
CRA v4 moved the service worker out of the core and into a template. Incorporate the template into the app. facebook/create-react-app#9776
CRA v4 moved the service worker out of the core and into a template. Incorporate the template into the app. facebook/create-react-app#9776
CRA v4 moved the service worker out of the core and into a template. Incorporate the template into the app. facebook/create-react-app#9776
I have just tried a new CRA with service worker and works fine, we just need to add as mentioned above, the following:
Here's my package.json
},` re-Run Did the same for an existing project, imported new files, but updated Hope that helps someone. |
Yeah that's an effective way to do it but with the command |
I had to uninstall and reinstall my global packages and update my project's Node version - mostly as a way of getting around CRA being really out of date - but I can confirm the |
It's been removed in the current create-react-app, see facebook/create-react-app#9776
It's been removed in the current create-react-app, see facebook/create-react-app#9776
Just a guess but perhaps the issue being encountered is related to an issue resolved in this PR: #11640 |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is still an issue. |
Describe the bug
./build/service-worker.js
is no longer generated at all (and there are no error messages) with the latest versions of CRA (4.x) using@next
.Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
N/A
Environment
(paste the output of the command here.)
Steps to reproduce
(Write your steps here:)
npx create-react-app test
cd test
npm install --save react-scripts@next
npm run build
ls -la ./build
Expected behavior
./build/service-worker.js
should be present.Actual behavior
The file is missing. This causes a problem with apps which are upgrading from prior CRA versions, as they continue to reference the cached service worker (so the web app continues to cache old assets).
Reproducible demo
Just run the commands above.
The text was updated successfully, but these errors were encountered: