Description:
When building a Nuxt 4 application with @vite-pwa/nuxt, the PWA assets (manifest.webmanifest, icons, favicon.ico, etc.) are correctly generated and placed in .output/public/. However, when running the production server with node .output/server/index.mjs, Nitro looks for these assets in .output/server/chunks/public/ instead, causing 404 errors.
Steps to Reproduce
- Create a new Nuxt 4 project
- Install and configure
@vite-pwa/nuxt:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vite-pwa/nuxt'],
pwa: {
registerType: 'autoUpdate',
manifest: {
name: 'Test App',
short_name: 'Test',
// ... manifest config
}
}
})
- Generate PWA assets (icons, manifest)
- Run
npm run build
- Run production
server: node .output/server/index.mjs
- Try to access
/manifest.webmanifest or /favicon.ico
Expected Behavior
The PWA assets should be served correctly from the production server without any manual intervention.
Actual Behavior
The server returns a 500/404 error with:
H3Error: ENOENT: no such file or directory, open '/path/to/.output/server/chunks/public/manifest.webmanifest'
Environment
- Nuxt version: 4.x (latest)
- @vite-pwa/nuxt version: latest (0.9.0)
- Nitro preset:
node-server (default)
- Node.js version: v24.16.0
- Package manager: npm
Additional Context
The assets are correctly generated in .output/public/:
$ ls .output/public/
manifest.webmanifest favicon.ico pwa-64x64.png pwa-192x192.png pwa-512x512.png maskable-icon-512x512.png apple-touch-icon-180x180.png
However, the production server expects them in .output/server/chunks/public/.
Temporary Workaround
After building, manually copy the assets:
mkdir -p .output/server/chunks/public && cp -r .output/public/* .output/server/chunks/public/
Or add to package.json:
{
"scripts": {
"build": "nuxt build && mkdir -p .output/server/chunks/public && cp -r .output/public/* .output/server/chunks/public/"
}
}
Related Issues / References
Possible Root Cause
The @vite-pwa/nuxt module writes assets to .output/public/, but when using the node-server preset in Nitro (default for Nuxt 4), the server expects static assets in .output/server/chunks/public/. This path mismatch breaks the PWA installation capability in production.
Suggested Fix
The module should detect the Nitro preset and write assets to the appropriate location, or Nitro should be configured to serve static assets from .output/public/ in all presets.
Labels
- #bug
- #production
- #nuxt4
- #nitro
Description:
When building a Nuxt 4 application with
@vite-pwa/nuxt, the PWA assets (manifest.webmanifest, icons, favicon.ico, etc.) are correctly generated and placed in.output/public/. However, when running the production server withnode .output/server/index.mjs, Nitro looks for these assets in.output/server/chunks/public/instead, causing 404 errors.Steps to Reproduce
@vite-pwa/nuxt:npm run buildserver: node .output/server/index.mjs/manifest.webmanifestor/favicon.icoExpected Behavior
The PWA assets should be served correctly from the production server without any manual intervention.
Actual Behavior
The server returns a 500/404 error with:
Environment
node-server(default)Additional Context
The assets are correctly generated in .output/public/:
However, the production server expects them in
.output/server/chunks/public/.Temporary Workaround
After building, manually copy the assets:
Or add to package.json:
{ "scripts": { "build": "nuxt build && mkdir -p .output/server/chunks/public && cp -r .output/public/* .output/server/chunks/public/" } }Related Issues / References
Possible Root Cause
The
@vite-pwa/nuxtmodule writes assets to.output/public/, but when using thenode-serverpreset in Nitro (default for Nuxt 4), the server expects static assets in.output/server/chunks/public/. This path mismatch breaks the PWA installation capability in production.Suggested Fix
The module should detect the Nitro preset and write assets to the appropriate location, or Nitro should be configured to serve static assets from
.output/public/in all presets.Labels