Skip to content

Commit abd8e5f

Browse files
committed
build: harden module name generation
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 7e1be39 commit abd8e5f

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

build/frontend/vite.config.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,11 @@ export default createAppConfig(Object.fromEntries(viteModuleEntries), {
107107
output: {
108108
entryFileNames: '[name].mjs',
109109
chunkFileNames: '[name]-[hash].chunk.mjs',
110-
assetFileNames(ctx) {
111-
const { originalFileNames } = ctx
112-
const [name] = originalFileNames
113-
if (name) {
114-
const [, appId] = name.match(/apps\/([^/]+)\//) ?? []
115-
if (appId) {
116-
return `${appId}-[name]-[hash][extname]`
117-
}
118-
}
119-
return '[name]-[hash][extname]'
110+
assetFileNames({ originalFileNames }) {
111+
const apps = originalFileNames.map((name) => name.match(/apps\/([^/]+)\//)?.[1])
112+
.filter(Boolean)
113+
const appId = apps.length === 1 ? apps[0] : 'common'
114+
return `${appId}-[name]-[hash][extname]`
120115
},
121116
experimentalMinChunkSize: 100 * 1024,
122117
/* // with rolldown-vite:

0 commit comments

Comments
 (0)