-
When using nuxt3 with I have a project structure like this pages/
└── products/
└── [handle].vue
nuxt.config.ts and in my export default defineNuxtConfig({
devtools: {
enabled: false
},
css: [
'@/assets/main.css'
],
modules: [
'@vite-pwa/nuxt'
],
pwa: {
manifest: {
name: 'foo',
short_name: 'foo',
background_color: '#f0f0f0',
theme_color: '#f0f0f0',
orientation: 'portrait',
display: 'standalone',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
},
registerType: 'autoUpdate',
workbox: {
navigateFallback: undefined,
globPatterns: [
"**/*.{js,css,html,png,jpg,jpeg,svg,webp,webm,woff2,woff,ttf,eot,webmanifest}"
],
runtimeCaching: [
{
urlPattern: /^https:\/\/cdn\.shopify\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'shopify-file-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
}
]
}
},
nitro: {
preset: 'netlify'
},
routeRules: {
'/products/**': {
headers: {
'netlify-cache-tag': 'products',
'cache-control': 'public, max-age=3600, must-revalidate',
'netlify-cdn-cache-control': 'public, s-maxage=300, stale-while, revalidate=604800'
}
}
},
compatibilityDate: '2024-07-06'
}) |
Beta Was this translation helpful? Give feedback.
Answered by
userquin
Jul 29, 2024
Replies: 1 comment 21 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/userquin/vite-pwa-nuxt-ssr-pages