Skip to content

Commit b84849f

Browse files
committed
improve the chunks
1 parent ea0b2df commit b84849f

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

vite.config.ts

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,42 @@ export default defineConfig(({ mode }) => {
3535
build: {
3636
emptyOutDir: true,
3737
rollupOptions: {
38-
...(buildTarget === 'extension' && buildPlatform === 'firefox'
39-
? {
40-
output: {
41-
manualChunks: () => 'main.js',
42-
entryFileNames: `assets/[name].js`,
43-
chunkFileNames: `assets/[name].js`,
44-
assetFileNames: `assets/[name].[ext]`,
45-
},
46-
}
47-
: {
48-
output: {
49-
manualChunks: {
50-
settings: [
51-
'react-contexify',
52-
'react-modal',
53-
'react-select',
54-
'react-share',
55-
'react-simple-toasts',
56-
'react-spinners',
57-
'react-toggle',
58-
'react-tooltip',
59-
],
60-
react: ['react', 'react-dom', 'react-router-dom', 'react-device-detect'],
61-
},
62-
},
63-
}),
38+
output: {
39+
entryFileNames: `assets/[name].js`,
40+
chunkFileNames: `assets/[name].js`,
41+
assetFileNames: `assets/[name].[ext]`,
42+
manualChunks: {
43+
core: [
44+
'react',
45+
'react-dom',
46+
'react-router-dom',
47+
'zustand',
48+
'@tanstack/react-query',
49+
'@tanstack/react-query-persist-client',
50+
'axios',
51+
'react-error-boundary',
52+
],
53+
ui: [
54+
'react-contexify',
55+
'react-select',
56+
'react-share',
57+
'react-simple-toasts',
58+
'react-toggle',
59+
'react-tooltip',
60+
'react-icons',
61+
'react-markdown',
62+
'react-spring-bottom-sheet',
63+
],
64+
utils: [
65+
'@amplitude/analytics-browser',
66+
'axios-cache-adapter',
67+
'country-emoji',
68+
'htmlparser2',
69+
'dompurify',
70+
'timeago.js',
71+
],
72+
},
73+
},
6474
},
6575
},
6676
server: {

0 commit comments

Comments
 (0)