-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
65 lines (55 loc) · 1.34 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
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import {env} from 'node:process';
import {resolve} from 'node:path';
import viteImagemin from '@vheemstra/vite-plugin-imagemin';
import imageminMozjpeg from 'imagemin-mozjpeg';
import imageminPngQuant from 'imagemin-pngquant';
import imageminSvgo from 'imagemin-svgo';
import imageminWebp from 'imagemin-webp';
import imageminGifSicle from 'imagemin-gifsicle';
const idDev = env.NODE_ENV === 'development';
export default defineConfig({
plugins: [
react(),
viteImagemin({
plugins: {
jpg: imageminMozjpeg(),
png: imageminPngQuant(),
gif: imageminGifSicle(),
svg: imageminSvgo(),
},
makeWebp: {
plugins: {
jpg: imageminWebp(),
png: imageminWebp(),
},
},
}),
],
css: {
devSourcemap: true,
modules: {
generateScopedName: idDev
? '[name]_[local]__[hash:base64:5]'
: '[hash:base64:4]',
},
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
reactRouter: ['react-router-dom'],
animations: ['framer-motion'],
extra: ['@tanstack/react-query'],
},
},
},
},
});