54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import { defineConfig } from 'vite'
|
||
import vue from '@vitejs/plugin-vue'
|
||
|
||
import path from "path";
|
||
|
||
// https://vitejs.dev/config/
|
||
export default defineConfig({
|
||
publicPath: '/',
|
||
plugins: [vue()],
|
||
define: {
|
||
'process.env': process.env
|
||
},
|
||
resolve: {
|
||
// 配置路径别名
|
||
alias: {
|
||
'@': path.resolve(__dirname, './src'),
|
||
},
|
||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
||
},
|
||
// vite 相关配置
|
||
server: {
|
||
// https: true,
|
||
port: 3001,
|
||
host: true,
|
||
open: true,
|
||
cors:true,
|
||
proxy: {
|
||
'/api': { //apiTest是自行设置的请求前缀,按照这个来匹配请求,有这个字段的请求,就会进到代理来
|
||
target: 'http://127.0.0.1:12307/',
|
||
changeOrigin: true, //是否跨域
|
||
rewrite: (path) => path.replace('/api', '')
|
||
},
|
||
'/aps': {
|
||
target: 'http://192.168.17.4:8001/',
|
||
changeOrigin: true, //是否跨域
|
||
rewrite: (path) => path.replace('/aps', '')
|
||
},
|
||
'/pro-api': {
|
||
target: 'http://192.168.17.8:8090/',
|
||
changeOrigin: true, //是否跨域
|
||
rewrite: (path) => path.replace('/pro-api', '')
|
||
}
|
||
}
|
||
},
|
||
// 全局配置scss方法
|
||
css: {
|
||
preprocessorOptions: {
|
||
scss: {
|
||
additionalData: `@import "@/assets/scss/common.scss";`,
|
||
},
|
||
},
|
||
},
|
||
})
|