-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
41 lines (40 loc) · 1.11 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
import { defineConfig } from 'vite'
const { resolve } = require('path')
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'/@': resolve(__dirname, 'src')
}
},
server: {
port: 5000
},
base: './',
build: {
assetsDir: 'assets',
//设置为 false 来禁用将构建后的文件写入磁盘
write: true,
//默认情况下,若 outDir 在 root 目录下,则 Vite 会在构建时清空该目录。
emptyOutDir: true,
//启用/禁用 brotli 压缩大小报告
brotliSize: true,
//chunk 大小警告的限制
chunkSizeWarningLimit: 500,
// 移除console
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
//调整控制台输出的级别 'info' | 'warn' | 'error' | 'silent'
logLevel: 'info',
//设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息
clearScreen: true
})