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
| import { defineConfig, Terser } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
base:'./', //打包公共路径
plugins: [vue()],
build:{
//打包环境移除console.log,debugger
minify:'terser',
terserOptions:{
compress:{
drop_console:true,
drop_debugger:true
}
},
//打包文件按照类型分文件夹显示
rollupOptions:{
output:{
chunkFileNames:'js/[name]-[hash].js',
entryFileNames:'js/[name]-[hash].js',
assetFileNames:'[ext]/[name]-[hash].[ext]'
}
}
},
server:{
proxy:{
'api':{
target:'csdn.net',
changeOrigin:true,
rewrite:(path)=> path.replace('/^\/api/','')
},
}
}
})
|