-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
68 lines (65 loc) · 1.41 KB
/
vite.config.js
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
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import FullReload from 'vite-plugin-full-reload';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
export default defineConfig({
plugins: [
react(),
FullReload(['./src/**/*.{js,jsx,tsx,css,json,svg,webp}']),
ViteImageOptimizer({
exclude: /^sprite.svg$/,
png: { quality: 75 },
jpeg: { quality: 75 },
jpg: { quality: 75 },
webp: { quality: 75 },
svg: {
multipass: true,
plugins: [{ name: 'removeViewBox', active: false }],
},
}),
visualizer({
open: true,
filename: 'dist/stats.html',
}),
],
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules/react')) {
return 'react';
}
if (id.includes('node_modules/redux')) {
return 'redux';
}
if (id.includes('node_modules/clsx')) {
return 'clsx';
}
},
},
},
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
output: {
comments: false,
},
},
cssCodeSplit: true,
},
css: {
preprocessorOptions: {
scss: {
additionalData: `
@use 'src/assets/styles/variables' as *;
@use 'src/assets/styles/mixins' as *;
@use 'src/assets/styles/functions' as *;
`,
silenceDeprecations: ['legacy-js-api'],
},
},
},
});