Unverified Commit 9317a541 authored by Sam Poder's avatar Sam Poder Committed by GitHub

[docs] Update "Handling a Custom `Service Worker`" in the CRA migration docs (#95434)

This is a follow-up to https://github.com/vercel/next.js/pull/95431; I
think we can directly mention this in this guide to make people's lives
easier (the PWA guide is quite long for this small chunk of code)
parent affd86f0
......@@ -529,7 +529,13 @@ export default nextConfig
### Handling a Custom `Service Worker`
If you used CRA’s service worker (e.g., `serviceWorker.js` from `create-react-app`), you can learn how to create [Progressive Web Applications (PWAs)](/docs/app/guides/progressive-web-apps) with Next.js.
If you used CRA’s service worker (e.g., `serviceWorker.js` from `create-react-app`), you can register this service worker using the following syntax:
```ts
await navigator.serviceWorker.register(new URL('../serviceWorker.js', import.meta.url), ...)
```
Learn more about how to create [Progressive Web Applications (PWAs)](/docs/app/guides/progressive-web-apps) with Next.js.
### Proxying API Requests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment