React CLI missing serviceWorker parameter #22624
Replies: 23 comments
-
Amazing! This would be great |
Beta Was this translation helpful? Give feedback.
-
Any plan to add serviceWorker support any time soon? I'd say that's fundamental. Any alternative in the meantime? |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Beta Was this translation helpful? Give feedback.
-
Is there any way to use service workers without it? |
Beta Was this translation helpful? Give feedback.
-
@xelaos Yes, create a custom webpack config like this:
And the
|
Beta Was this translation helpful? Give feedback.
-
@TriPSs Thank you very much for your help. I used the custom webpack config and added the service-worker-workbox.ts, but I still don't quite get it to work. |
Beta Was this translation helpful? Give feedback.
-
@xelaos sorry, you also need to add this to the main.ts (or other start point) to load the service worker:
|
Beta Was this translation helpful? Give feedback.
-
Yes, I did that, there the error occurs I mentioned above.
Since it creates a service-worker.js file like this:
The other version you outlined above just duplicated the code of the service-worker-workbox.ts file. |
Beta Was this translation helpful? Give feedback.
-
@xelaos It indeeds duplicates it but also injects all the files that where compiled with webpack, that is where these lines are for:
I'm not quite sure why you get an error with the other one, here its working fine. |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Is there a plan to make this part of the react application generation? This is a big missing compared to create-react-app. |
Beta Was this translation helpful? Give feedback.
-
any news? |
Beta Was this translation helpful? Give feedback.
-
Updates? |
Beta Was this translation helpful? Give feedback.
-
Is there any plans to include service worker support ? |
Beta Was this translation helpful? Give feedback.
-
Bump to prevent stale. This is a major feature nowadays, and would be nice to have it built in. |
Beta Was this translation helpful? Give feedback.
-
Totally agree! |
Beta Was this translation helpful? Give feedback.
-
Our team also ran into this just now - support for this would be phenomenal 🙌 |
Beta Was this translation helpful? Give feedback.
-
Ready to test on our apps... |
Beta Was this translation helpful? Give feedback.
-
No updates I'm afraid? Also running into this, would be great if this is now possible. |
Beta Was this translation helpful? Give feedback.
-
I'm also missing this feature. Will try to implement something custom made for now, but support out of the box would be great to have in future. |
Beta Was this translation helpful? Give feedback.
-
I've moved this to the discussion boards as there are more github features for discussions and feature requests there. I still think this would be a good feature. Since this discussion first started, we've also added more ways to build React apps via Vite. Let's keep discussing for ways people would like this feature to be implemented. cc @jaysoo |
Beta Was this translation helpful? Give feedback.
-
As is an option for angular: https://nx.dev/previous/react/cli/build#serviceworker
Description
It would be expected to have PWA support with react apps as well.
Motivation
I see no reason why this option would be denied.
Beta Was this translation helpful? Give feedback.
All reactions