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

This commit is contained in:
Daniel Roe 2024-03-15 11:31:13 -07:00 committed by GitHub
parent 5804d397ad
commit b9168d0b0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View File

@ -122,8 +122,8 @@ export async function buildClient (ctx: ViteBuildContext) {
// We want to respect users' own rollup output options // We want to respect users' own rollup output options
clientConfig.build!.rollupOptions = defu(clientConfig.build!.rollupOptions!, { clientConfig.build!.rollupOptions = defu(clientConfig.build!.rollupOptions!, {
output: { output: {
chunkFileNames: ctx.nuxt.options.dev ? undefined : 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, '[name].[hash].js')) entryFileNames: ctx.nuxt.options.dev ? 'entry.js' : withoutLeadingSlash(join(ctx.nuxt.options.app.buildAssetsDir, '[hash].js'))
} satisfies NonNullable<BuildOptions['rollupOptions']>['output'] } satisfies NonNullable<BuildOptions['rollupOptions']>['output']
}) as any }) as any

View File

@ -7,6 +7,20 @@ export default defineNuxtConfig({
experimental: { experimental: {
externalVue: !testWithInlineVue externalVue: !testWithInlineVue
}, },
$production: {
vite: {
$client: {
build: {
rollupOptions: {
output: {
chunkFileNames: '_nuxt/[name].js',
entryFileNames: '_nuxt/[name].js'
}
}
}
}
}
},
buildDir: testWithInlineVue ? '.nuxt-inline' : '.nuxt', buildDir: testWithInlineVue ? '.nuxt-inline' : '.nuxt',
nitro: { nitro: {
output: { dir: fileURLToPath(new URL(testWithInlineVue ? './.output-inline' : './.output', import.meta.url)) } output: { dir: fileURLToPath(new URL(testWithInlineVue ? './.output-inline' : './.output', import.meta.url)) }