Skip to content

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

Open
sampoder wants to merge 1 commit into
sp-pwa-sw-new-syntax-docsfrom
sp-cra-sw-register-syntax
Open

[docs] Update "Handling a Custom Service Worker" in the CRA migration docs#95434
sampoder wants to merge 1 commit into
sp-pwa-sw-new-syntax-docsfrom
sp-cra-sw-register-syntax

Conversation

@sampoder

@sampoder sampoder commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

This is a follow-up to #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)

@github-actions

github-actions Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: 42eec9e
View workflow run

@github-actions

github-actions Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: 42eec9e

@sampoder sampoder requested a review from icyJoseph July 2, 2026 22:02
@sampoder sampoder marked this pull request as ready for review July 2, 2026 22:03
@sampoder sampoder force-pushed the sp-pwa-sw-new-syntax-docs branch from f235e2c to 721dcb6 Compare July 2, 2026 22:06
@sampoder sampoder force-pushed the sp-cra-sw-register-syntax branch from 660ebf8 to 42eec9e Compare July 2, 2026 22:06
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), ...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await navigator.serviceWorker.register(new URL('../serviceWorker.js', import.meta.url), ...)
await navigator.serviceWorker.register(new URL('../serviceWorker.js', import.meta.url))

Docs code sample uses a bare ... as a function argument, which is a SyntaxError when copied

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant