forked from FRONTENDSCHOOL6/escape12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
63 lines (59 loc) · 1.54 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
import react from '@vitejs/plugin-react';
import { resolve } from 'node:path';
import { defineConfig } from 'vite';
import { env } from 'node:process';
import viteImagemin from '@vheemstra/vite-plugin-imagemin';
import imageminGifSicle from 'imagemin-gifsicle';
import imageminMozjpeg from 'imagemin-mozjpeg';
import imageminPngQuant from 'imagemin-pngquant';
import imageminSvgo from 'imagemin-svgo';
import imageminWebp from 'imagemin-webp';
import { splitVendorChunkPlugin } from 'vite';
const isDev = env.NODE_ENV === 'development';
export default defineConfig({
plugins: [
react(),
splitVendorChunkPlugin(),
viteImagemin({
plugins: {
jpg: imageminMozjpeg(),
png: imageminPngQuant(),
gif: imageminGifSicle(),
svg: imageminSvgo(),
},
makeWebp: {
plugins: {
jpg: imageminWebp(),
png: imageminWebp(),
},
},
}),
],
css: {
devSourcemap: true,
modules: {
generateScopedName: isDev
? '[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: ['gsap'],
},
},
},
terserOptions: {
comments: false,
},
},
});