diff --git a/packages/vite/src/client.ts b/packages/vite/src/client.ts index 6f408c962a..2c57e013c7 100644 --- a/packages/vite/src/client.ts +++ b/packages/vite/src/client.ts @@ -122,8 +122,8 @@ export async function buildClient (ctx: ViteBuildContext) { // We want to respect users' own rollup output options clientConfig.build!.rollupOptions = defu(clientConfig.build!.rollupOptions!, { output: { - chunkFileNames: ctx.nuxt.options.dev ? undefined : withoutLeadingSlash(join(ctx.nuxt.options.app.buildAssetsDir, '[name].[hash].js')), - entryFileNames: ctx.nuxt.options.dev ? 'entry.js' : withoutLeadingSlash(join(ctx.nuxt.options.app.buildAssetsDir, '[name].[hash].js')) + chunkFileNames: ctx.nuxt.options.dev ? undefined : withoutLeadingSlash(join(ctx.nuxt.options.app.buildAssetsDir, '[hash].js')), + entryFileNames: ctx.nuxt.options.dev ? 'entry.js' : withoutLeadingSlash(join(ctx.nuxt.options.app.buildAssetsDir, '[hash].js')) } satisfies NonNullable['output'] }) as any diff --git a/test/fixtures/minimal/nuxt.config.ts b/test/fixtures/minimal/nuxt.config.ts index 282603890b..9f9bac810f 100644 --- a/test/fixtures/minimal/nuxt.config.ts +++ b/test/fixtures/minimal/nuxt.config.ts @@ -7,6 +7,20 @@ export default defineNuxtConfig({ experimental: { externalVue: !testWithInlineVue }, + $production: { + vite: { + $client: { + build: { + rollupOptions: { + output: { + chunkFileNames: '_nuxt/[name].js', + entryFileNames: '_nuxt/[name].js' + } + } + } + } + } + }, buildDir: testWithInlineVue ? '.nuxt-inline' : '.nuxt', nitro: { output: { dir: fileURLToPath(new URL(testWithInlineVue ? './.output-inline' : './.output', import.meta.url)) }