Files
intc-iot-screen/vite.config.js
2025-04-24 17:33:56 +08:00

50 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"),
},
},
})