From 156178f8d15b5886d3f91d088fcd9f5f9c1a2198 Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 18 Apr 2025 16:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=85=8D=E7=BD=AE=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/vite.config.js b/vite.config.js index edb9d48..b66b8a2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,12 +1,25 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' // - -// https://vite.dev/config/ export default defineConfig({ - plugins: [vue()], + plugins: [vue()], // server: { - host: '192.168.1.102', // 监听所有 IP - port: 5173 // 指定端口(可选) - } + host: '192.168.1.102', + port: 5173, + // 错误1:server 块内不能嵌套 plugins 配置(已删除) + proxy: { + '/api': { + target: 'http://192.168.99.223:3000', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, '') + } + } + }, + resolve: { // + alias: { + "/@": resolve(__dirname, "src"), // + } + }, + base: process.env.NODE_ENV === "production" ? "./" : "/", })