forked from SkalskiP/make-sense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
69 lines (65 loc) · 1.79 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import {
defineConfig,
loadEnv,
UserConfig,
UserConfigExport,
} from 'vite';
import react from '@vitejs/plugin-react';
export default ({ mode }: UserConfig): UserConfigExport => {
process.env = { ...process.env, ...loadEnv(mode || 'development', process.cwd()) };
return defineConfig({
plugins: [react()],
build: {
minify: 'terser',
sourcemap: mode === 'development',
chunkSizeWarningLimit: 1024 * 1024,
rollupOptions: {
treeshake: true,
maxParallelFileReads: 4,
output: {
manualChunks: {
lodash: ['lodash'],
classnames: ['classnames'],
runtime: ['react', 'react-is'],
'runtime-dom': ['react-dom'],
ai: ['@tensorflow/tfjs',
'@tensorflow/tfjs-backend-cpu',
'@tensorflow/tfjs-backend-webgl',
'@tensorflow/tfjs-core',
'@tensorflow/tfjs-node'],
models: [
'@tensorflow-models/coco-ssd',
'@tensorflow-models/posenet',
],
ui: ['@mui/material', '@mui/system'],
moment: ['moment']
},
},
},
},
esbuild: {
logOverride: { 'this-is-undefined-in-esm': 'silent' }
},
css: {
modules: {
generateScopedName: mode === 'development' ? '[name]__[local]___[hash:base64:5]' : '[hash:base64:8]',
scopeBehaviour: 'local',
localsConvention: 'camelCase',
},
postcss: {
plugins: [
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
},
},
},
],
},
},
});
};