build(dom-css): stabilize DOM/CSS chunk names

This commit is contained in:
Danila Poyarkov 2026-06-06 10:36:22 +03:00
parent 4811cac69b
commit 6b3b2d68a7

View file

@ -20,5 +20,22 @@ export default defineConfig({
deps: {
neverBundle: ['@open-pencil/core', /^@open-pencil\/core\//, 'node:fs/promises'],
onlyBundle: false
},
outputOptions: {
minifyInternalExports: false,
codeSplitting: {
groups: [
{
test: /(?<!\.d\.c?ts)$/,
name: (id) => {
const cleanId = id.split('?')[0]
const parts = cleanId.split(/[\\/]/g)
const srcIndex = parts.lastIndexOf('src')
const file = srcIndex >= 0 ? parts.slice(srcIndex + 1).join('/') : parts.at(-1) ?? 'chunk'
return `chunks/${file.replace(/\.(ts|tsx)$/, '')}`
}
}
]
}
}
})