Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vite): drop name prefix for client chunk file names #26203

Merged
merged 8 commits into from
Mar 15, 2024
4 changes: 2 additions & 2 deletions packages/vite/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<BuildOptions['rollupOptions']>['output']
}) as any

Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/minimal/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) }
Expand Down