2024-04-12 09:26:48 +08:00
|
|
|
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,
|
2024-06-04 15:25:57 +08:00
|
|
|
open: false,
|
2024-04-12 09:26:48 +08:00
|
|
|
base: "./ ", //生产环境路径
|
|
|
|
// hmr: true,
|
2024-05-11 14:30:29 +08:00
|
|
|
proxy: {
|
|
|
|
// 第一个代理
|
|
|
|
"/api": {
|
|
|
|
// 匹配到啥来进行方向代理
|
2024-08-29 16:52:05 +08:00
|
|
|
target: "http://10.0.0.65:8095/", //刘进
|
|
|
|
// target: "http://220.191.238.50:996/", //线上
|
2024-05-11 14:30:29 +08:00
|
|
|
changeOrigin: true, //是否支持跨域
|
|
|
|
//rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个
|
|
|
|
},
|
|
|
|
},
|
2024-04-12 09:26:48 +08:00
|
|
|
},
|
|
|
|
define: {
|
|
|
|
"process.env": {
|
|
|
|
BASE_URL: "/",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: [
|
|
|
|
{
|
|
|
|
find: "@",
|
|
|
|
replacement: resolve(__dirname, "src"),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2024-06-24 16:04:31 +08:00
|
|
|
|
|
|
|
build: {
|
|
|
|
chunkSizeWarningLimit: 1500,
|
|
|
|
assetsDir: "assets", // 指定生成静态文件目录
|
|
|
|
},
|
|
|
|
base: "./",
|
2024-04-12 09:26:48 +08:00
|
|
|
});
|