-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
29 lines (27 loc) · 931 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import {VitePWA} from 'vite-plugin-pwa';
import {pwaOptions} from './src/config/pwa.js';
const PACKAGE_INTO_CHUNKS = {
'react': ['@remix-run', 'react-dom', 'react-router-dom'],
'styled-system': ['styled-system', '@emotion', 'Core', 'theme-options.ts'],
'peerjs': ['peerjs', 'webrtc', 'lodash', 'cbor-x'],
'framer-motion': ['framer-motion'],
};
export default defineConfig({
plugins: [react(), VitePWA(pwaOptions)],
build: {
minify: true,
rollupOptions: {
output: {
manualChunks(id: string) {
for (const [key, value] of Object.entries(PACKAGE_INTO_CHUNKS)) {
if (value.find(x => id.includes(x))) {
return key;
}
}
},
},
}
},
});