ggfwjsc/vite.config.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

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-11-07 16:55:27 +08:00
target: "http://10.0.0.35:8095/", //刘进
2024-10-21 17:26:11 +08:00
// target: "https://jzzf.longyou.gov.cn:998/", //线上
2024-10-10 16:02:03 +08:00
// target: "http://220.191.238.50:996/", //线上
2024-10-08 16:44:15 +08:00
// target: "https://zzdyyfb.dsjj.qz.gov.cn/web/mgop/gov-open/zj/2002428903/reserved/", //线上
2024-05-11 14:30:29 +08:00
changeOrigin: true, //是否支持跨域
2024-10-08 16:44:15 +08:00
// rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个
2024-05-11 14:30:29 +08:00
},
},
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
});