Skip to content

Commit fcb1d58

Browse files
chore(vite): build manual chunk
1 parent 624912f commit fcb1d58

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

vite.config.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import react from '@vitejs/plugin-react-swc';
2-
import { defineConfig, splitVendorChunkPlugin } from 'vite';
2+
import { defineConfig } from 'vite';
33
import { VitePWA, Options } from 'vite-plugin-pwa';
44

55
const pwaSettings: Partial<Options> = {
@@ -58,7 +58,20 @@ export default () => {
5858
build: {
5959
sourcemap: true,
6060
minify: process.env.NO_MINIFY ? false : 'esbuild',
61+
rollupOptions: {
62+
output: {
63+
manualChunks(id) {
64+
if (id.includes('node_modules/openchemlib/')) {
65+
return 'openchemlib';
66+
}
67+
68+
if (id.includes('node_modules')) {
69+
return 'vendor';
70+
}
71+
},
72+
},
73+
}
6174
},
62-
plugins: [react(), splitVendorChunkPlugin(), VitePWA(pwaSettings)],
75+
plugins: [react(), VitePWA(pwaSettings)],
6376
});
6477
};

0 commit comments

Comments
 (0)