Skip to content

Commit

Permalink
Explicitly define output filename for prod builds
Browse files Browse the repository at this point in the history
Per vitejs/vite#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.
  • Loading branch information
rnathuji committed Jan 13, 2023
1 parent fb6110c commit 847aa22
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vite.config.ts
Expand Up @@ -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
Expand Down

0 comments on commit 847aa22

Please sign in to comment.