Merge pull request #58505 from nextcloud/build/vite-config

build: fix vite config for assets imported from node modules
This commit is contained in:
Ferdinand Thiessen 2026-02-23 10:26:18 +01:00 committed by GitHub
commit fabf017fd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,11 +100,14 @@ export default createAppConfig(Object.fromEntries(viteModuleEntries), {
output: {
entryFileNames: '[name].mjs',
chunkFileNames: '[name]-[hash].chunk.mjs',
assetFileNames({ originalFileNames }) {
assetFileNames(ctx) {
const { originalFileNames } = ctx
const [name] = originalFileNames
if (name) {
const [, appId] = name.match(/apps\/([^/]+)\//)!
return `${appId}-[name]-[hash][extname]`
const [, appId] = name.match(/apps\/([^/]+)\//) ?? []
if (appId) {
return `${appId}-[name]-[hash][extname]`
}
}
return '[name]-[hash][extname]'
},