mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Try a different code-splitting tactic
This commit is contained in:
1 file changed
+22
@@ -12,6 +12,28 @@ export default defineConfig(() => ({
|
||||
plugins: [
|
||||
react(),
|
||||
],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
// get the path after "node_modules/"
|
||||
const parts = id.toString().split('node_modules/')[1].split('/');
|
||||
|
||||
// handle scoped packages (@scope/name)
|
||||
const pkgName = parts[0].startsWith('@')
|
||||
? `${parts[0]}/${parts[1]}`
|
||||
: parts[0];
|
||||
|
||||
return `npm/${pkgName.replace('@', '')}`;
|
||||
}
|
||||
if (id.includes('/src/')) {
|
||||
return 'app';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
|
||||
Reference in new issue
Block a user