import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import { resolve } from "path"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], server: { host: "0.0.0.0", //解决vite use--host to expose port: 8080, open: false, base: "./ ", //生产环境路径 // hmr: true, proxy: { // 第一个代理 "/api": { // 匹配到啥来进行方向代理 target: "http://10.0.0.65:8095/", //刘进 // target: "http://220.191.238.50:996/", //线上 changeOrigin: true, //是否支持跨域 //rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个 }, }, }, define: { "process.env": { BASE_URL: "/", }, }, resolve: { alias: [ { find: "@", replacement: resolve(__dirname, "src"), }, ], }, build: { chunkSizeWarningLimit: 1500, assetsDir: "assets", // 指定生成静态文件目录 }, base: "./", });