代码初始化
This commit is contained in:
49
vite.config.js
Normal file
49
vite.config.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import autoImport from 'unplugin-auto-import/vite' // 自动导入
|
||||
import { resolve } from 'path' // 配置 @ 指向src
|
||||
import px2rem from 'postcss-px2rem' // 引入rem包
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
autoImport({
|
||||
dts: true,
|
||||
imports: ['vue', 'vue-router']
|
||||
})
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': { // 匹配请求路径,
|
||||
// target: 'http://140.249.205.82:8288', // 代理的目标地址
|
||||
target: 'http://127.0.0.1:8080', // 代理的目标地址
|
||||
changeOrigin: true,
|
||||
// secure: true, // 是否https接口
|
||||
// ws: true, // 是否代理websockets
|
||||
// 路径重写,**** 如果你的后端有统一前缀(如:/api),就不开启;没有就开启
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
},
|
||||
'/fileUrl': {
|
||||
target: 'http://140.249.24.92:9000', // 本地
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/fileUrl/, '')
|
||||
},
|
||||
}
|
||||
},
|
||||
css: {
|
||||
loaderOptions: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
px2rem({
|
||||
// 基准大小 baseSize,需要和rem.js中相同
|
||||
remUnit: 100
|
||||
})
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user