pmndrs / react-three-next

React Three Fiber, Threejs, Nextjs starter
https://react-three-next.vercel.app/
MIT License
2.52k stars 342 forks source link

"GenerateSW has been called multiple times" error when running in dev mode #91

Closed claritise closed 1 year ago

claritise commented 2 years ago

This is a fresh clone of the latest commit. This also causes a service error when visiting the webpack server in the browser.

image


$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: /Users/annazhang/git/3d-nft/3d-nft/node_modules/next-pwa/register.js
> [PWA] Service worker: /Users/annazhang/git/3d-nft/3d-nft/.next/sw.js
> [PWA]   url: /sw.js
> [PWA]   scope: /
> [PWA] Build in develop mode, cache and precache are mostly disabled. This means offline support is disabled, but you can continue developing other functions in service worker.
> [PWA] Compile server
> [PWA] Compile server
event - compiled client and server successfully in 2.8s (1021 modules)
wait  - compiling / (client and server)...
warn  - GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.
warn  - GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.
wait  - compiling /404 (client and server)...
warn  - GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.```
ydrea commented 2 years ago

same here!

loganbutler commented 2 years ago

This error isn't too much of an issue, because when your code gets auto-updated in the browser it re-calls the function. aka, expected behavior. You wont see this error in a production mode, and the function will not be called multiple times. This only happens on your local env.

The issue further down the pipe is the fact that the SW does not install at all for me, even in a production env because "the app does not work offline". I also had to copy the sw.js to the /public directory manually, to fix the 404 error in production env. I assume that would also fix your local issue, but thats hacky. Shouldn't have to copy that file anywhere.

image

juliocarneiro commented 2 years ago

This error isn't too much of an issue, because when your code gets auto-updated in the browser it re-calls the function. aka, expected behavior. You wont see this error in a production mode, and the function will not be called multiple times. This only happens on your local env.

The issue further down the pipe is the fact that the SW does not install at all for me, even in a production env because "the app does not work offline". I also had to copy the sw.js to the /public directory manually, to fix the 404 error in production env. I assume that would also fix your local issue, but thats hacky. Shouldn't have to copy that file anywhere.

image

copy the sw.js to the /public directory manually work for me!

RenaudRohlinger commented 2 years ago

Thanks!

next-pwa was not up to date with the latest version of nextjs but everything should be fine now: https://github.com/shadowwalker/next-pwa/commit/1e6af5fa9f6a807930f451adb5ab5078d5cda451#diff-38fcdef48d4c9636b640c40cb75b5278d405ab90f1b0960895900a068436f4cb

Please try again with a fresh install of react-three-next and close the issue if that fixes your problem :)