-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
58 lines (57 loc) · 1.38 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
import styleImport from 'vite-plugin-style-import'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
styleImport(
{
libs:[
{
libraryName:'vant',
esModule:true,
resolveStyle:(name) => `vant/es/${name}/style`
}
]
}
)
],
base: process.env.NODE_ENV === 'production' ? '/tank/' : '/',
server:{
open:true,
port: 8080,
host:'0.0.0.0',
proxy:{
'/eam':{
target:'http://103.113.6.179:8086',
changeOrigin:true,
// rewrite:(path)=>path.replace(/^\/api/,'')
}
}
},
resolve:{
alias:{
"@": path.resolve(__dirname, "src"),
}
},
build:{
rollupOptions: {
// plugins: [dynamicImportVars()], //https://github.com/orca-studio/vue-template/tree/vite-3.X
output: {
assetFileNames: (AssetInfo)=>{
if(/\.(png|jpg|gif)$/.test(AssetInfo.name)){
return 'img/[name].[hash].[ext]'
}else if(/\.(ttf|woff)$/.test(AssetInfo.name)){
return 'font/[name].[hash].[ext]'
}else{
return '[ext]/[name].[hash].[ext]'
}
},
chunkFileNames: 'js/[name].[hash].js',
entryFileNames: 'js/[name].[hash].js'
}
}
}
})