diff --git a/packages/vite/src/vite.ts b/packages/vite/src/vite.ts index 7e200c1a42..e231f2e0ba 100644 --- a/packages/vite/src/vite.ts +++ b/packages/vite/src/vite.ts @@ -86,7 +86,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => { // https://github.com/vitejs/vite/tree/main/packages/vite/src/node/build.ts#L464-L478 assetFileNames: nuxt.options.dev ? undefined - : chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.name!))}.[hash].[ext]`)), + : chunk => withoutLeadingSlash(join(nuxt.options.app.buildAssetsDir, `${sanitizeFilePath(filename(chunk.names[0]!))}.[hash].[ext]`)), }, }, watch: {