`non-preached-url` with `@vite-pwa/nuxt`

Hello, I get Uncaught (in promise) non-precached-url: non-precached-url :: [{"url":"/"}] error when visiting my homepage. My config is pretty basic:
pwa: {
registerType: 'autoUpdate',
workbox: {
navigateFallback: '/',
},
},
pwa: {
registerType: 'autoUpdate',
workbox: {
navigateFallback: '/',
},
},
How do I fix the error?
2 Replies
kapa.ai
kapa.ai6d ago
Hi @Denis Jankelaic. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, there isn't specific information about the exact error you're encountering or a direct solution to your issue with @vite-pwa/nuxt. However, I can provide some general guidance based on related information from the sources. The error you're seeing suggests that there might be an issue with the prerendering or caching of your routes. To address this, you could try the following: 1. Ensure that your homepage ('/') is properly prerendered. You can do this by adding it to the routes array in the nitro.prerender configuration:
export default defineNuxtConfig({
nitro: {
prerender: {
routes: ['/']
}
},
// ... rest of your config
})
export default defineNuxtConfig({
nitro: {
prerender: {
routes: ['/']
}
},
// ... rest of your config
})
2. You might also want to consider using routeRules to explicitly set prerendering for your routes. For example:
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true }
},
// ... rest of your config
})
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true }
},
// ... rest of your config
})
3. If you're building a static site, make sure you're using the correct build command. As mentioned in the Nuxt documentation on prerendering (https://nuxt.com/docs/getting-started/prerendering), you should use nuxi generate or nuxt build --prerender for static site generation. 4. Check if you have any dynamic routes that might not be discoverable by the prerenderer. If you do, you may need to explicitly add them to the routes array in the nitro.prerender configuration. If these suggestions don't resolve your issue, you might need to provide more details about your setup and how you're building and deploying your application. The error you're seeing isn't directly addressed in the provided knowledge sources, so a more specific solution would require more context about your particular use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6d ago
<@1147053396247986226> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Want results from more Discord servers?
Add your server