chore: update pwa module configuration

This commit is contained in:
userquin 2023-01-20 19:37:37 +01:00
parent c189f951ff
commit 8552bc96f9

View file

@ -112,11 +112,11 @@ export default defineNuxtModule<VitePWANuxtOptions>({
next() next()
} }
nuxt.hook('vite:serverCreated', (viteServer, { isServer }) => { nuxt.hook('vite:serverCreated', (viteServer, { isServer }) => {
if (isServer || !tauriPlatform) if (isServer)
return return
viteServer.middlewares.stack.push({ route: webManifest, handle: emptyHandle }) viteServer.middlewares.stack.push({ route: webManifest, handle: emptyHandle })
if (webmanifests) { if (webmanifests && !tauriPlatform) {
Object.keys(webmanifests).forEach((wm) => { Object.keys(webmanifests).forEach((wm) => {
viteServer.middlewares.stack.push({ viteServer.middlewares.stack.push({
route: `${nuxt.options.app.baseURL}manifest-${wm}.webmanifest`, route: `${nuxt.options.app.baseURL}manifest-${wm}.webmanifest`,
@ -141,6 +141,7 @@ export default defineNuxtModule<VitePWANuxtOptions>({
} }
else { else {
nuxt.hook('nitro:config', async (nitroConfig) => { nuxt.hook('nitro:config', async (nitroConfig) => {
// /manifest.webmanifest added on nuxt config file
if (!tauriPlatform) if (!tauriPlatform)
return return