MSW fails to start on Safari #1011
-
When I run my app on Chrome and Firefox, everything works fine. If I run it on Safari it breaks, unless I exit Safari and restart it. Digging a bit more, the code gets as far as and then that call toonce() never returns.
If I reload Safari and it can read from cache, then msw initialization works as expected. Any suggestions as to what I might be missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think that I've got it. If you've followed one of the create-react-app templates that uses service-workers (e.g. |
Beta Was this translation helpful? Give feedback.
I think that I've got it.
If you've followed one of the create-react-app templates that uses service-workers (e.g.
https://github.com/facebook/create-react-app/blob/3.x/packages/cra-template-typescript/template/src/index.tsx#L17
), then the call to
serviceWorker.unregister()
breaks msw registration on Safari. Remove this line and everything is back to working.