From 847aa22937d46053e7be0b6bf3fb5ba9f611dfc1 Mon Sep 17 00:00:00 2001 From: Ripal Nathuji Date: Fri, 13 Jan 2023 10:31:41 -0600 Subject: [PATCH] Explicitly define output filename for prod builds Per https://github.com/vitejs/vite/pull/10927, there was a change made as part of vite 4 to align default build file names with the default from rollup. While this is mostly superficial for us, since the change causes a slight difference in the production filename artifact I'm explicitly adding a configuration for it. --- vite.config.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 02c28cb3..b9ead3fc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,21 +13,28 @@ export default defineConfig(({ mode }) => { } } - // In development mode don't include a hash in the filename if (mode === 'development') { + // In development mode don't include a hash in the filename config.build['rollupOptions'] = { output: { assetFileNames: 'assets/[name][extname]', entryFileNames: 'assets/[name].js' } } - } else if (mode == 'authoring') { + } else if (mode == 'authoring') { config.build['rollupOptions'] = { output: { assetFileNames: 'assets/[name].authoring.[hash][extname]', entryFileNames: 'assets/[name].authoring.[hash].js' } } + } else { + config.build['rollupOptions'] = { + output: { + assetFileNames: 'assets/[name].[hash][extname]', + entryFileNames: 'assets/[name].[hash].js' + } + } } return config