You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
800 B

import { defineConfig,loadEnv } from "vite";
import { wrapperEnv } from "./build/utils";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path"; //
export default defineConfig(({ command, mode }) => {
const root = process.cwd();
const env = loadEnv(mode, root);
const viteEnv = wrapperEnv(env);
const { VITE_PUBLIC_PATH, VITE_OUTPUT_DIR } = viteEnv;
return {
base: VITE_PUBLIC_PATH,
plugins: [vue()], //
server: {
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: {
},
};
});