vite-pwa / nuxt

Zero-config PWA Plugin for Nuxt 3
https://vite-pwa-org.netlify.app/frameworks/nuxt
MIT License
454 stars 22 forks source link

@vite-pwa/assets-generator and @vite-pwa/nuxt give error only in production, related to workbox #150

Closed meliceanu closed 4 months ago

meliceanu commented 4 months ago

Hey👋,

for some reason i only get this error in production, seems to be related to the precaching of urls by workbox. I tried many different ways to at least get rid of this error, but nothing. Do you guys have any suggestions? Why is this happening in production and gives no errors in development?

Only by unistalling those dependencies remove the error, but i'm curious of why that happens.

Operating System: Darwin Node Version: v22.1.0 Nuxt Version: 3.12.2 CLI Version: 3.12.0 Nitro Version: 2.9.7 Package Manager: pnpm@9.1.1 Builder: - User Config: apollo, app, build, css, delayHydration, devtools, experimental, formkit, gtm, i18n, modules, nitro, pwa, runtimeConfig, site, sitemap, sourcemap, ssr, vite Runtime Modules: @nuxtjs/i18n@8.3.1, @nuxtjs/sitemap@5.2.2, @nuxtjs/apollo@5.0.0-alpha.8, @pinia/nuxt@0.4.11, @vite-pwa/nuxt@0.8.1, @formkit/nuxt@1.6.5, nuxt-delay-hydration@1.3.3, @zadigetvoltaire/nuxt-gtm@0.0.13 Build Modules: -

screenshot

Thank You!

userquin commented 4 months ago

you need to prerender / page, workbox requires the html

userquin commented 4 months ago

Check https://github.com/vite-pwa/nuxt/blob/main/playground/nuxt.config.ts#L16-L25

You can also use routeRules, check the prerender docs.

Check also https://vite-pwa-org.netlify.app/guide/cookbook.html

meliceanu commented 4 months ago

https://github.com/vite-pwa/vite-plugin-pwa/issues/731