This commit is contained in:
Aiden 2024-09-24 16:02:13 +08:00
parent 7c7acef535
commit 20336eeadd

View File

@ -1,13 +1,15 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni"; import uni from "@dcloudio/vite-plugin-uni";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],
server: { server: {
// 选项写法 // 选项写法
"/": { "/api": {
target: process.env.VITE_API_URL, // 目标地址 target: process.env.VITE_API_URL, // 目标地址
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
}, },
host: "0.0.0.0", // 这个用于启动 host: "0.0.0.0", // 这个用于启动
port: 8093, // 指定启动端口 port: 8093, // 指定启动端口