1.0
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
},
|
||||
server: {
|
||||
host: "localhost",
|
||||
cors: true,
|
||||
port: 1111,
|
||||
open: false, //自动打开
|
||||
proxy: {
|
||||
// 这里的ccc可乱写, 是拼接在url后面的地址 如果接口中没有统一的后缀可自定义
|
||||
// 如果有统一后缀, 如api, 直接写api即可, 也不用rewrite了
|
||||
"^/back": {
|
||||
target: "http://localhost:8090", // 真实接口地址, 后端给的基地址
|
||||
changeOrigin: true, // 允许跨域
|
||||
secure: false, //关键参数,不懂的自己去查
|
||||
rewrite: (path) => path.replace(/^\/back/, '/back')
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user