-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
73 lines (66 loc) · 1.45 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
69
70
71
72
73
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
import { terser } from 'rollup-plugin-terser'
import imageminPlugin from 'vite-plugin-imagemin'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, 'src/main.jsx')
}
},
plugins: [
react(),
tailwindcss(),
imageminPlugin({
gifsicle: { optimizationLevel: 3, interlaced: true },
mozjpeg: { quality: 75, progressive: true },
optipng: { optimizationLevel: 7 },
pngquant: { quality: [0.75, 0.9], speed: 1 },
svgo: { plugins: [{ removeViewBox: false }] },
cache: true,
}),
],
appType: 'spa',
preview: {
port: 3000,
open: true,
},
optimizeDeps: {
include: ['linked-dep'],
},
mode: 'production',
build: {
sourcemap: true,
commonjsOptions: {
include: [/linked-dep/, /node_modules/],
},
server: {
hmr: {
port: 443
},
host: true,
},
rollupOptions: {
plugins: [terser()],
output: {
manualChunks(id) {
if (id.includes('/src/')) {
return 'app';
}
if (id.includes('/node_modules/')) {
return 'vendor';
}
}
}
}
},
css: {
postcss: {
plugins: [tailwindcss(), autoprefixer()]
},
},
})