Files
senmesh-zc/vite.config.ts

38 lines
909 B
TypeScript
Raw Normal View History

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
// https://vite.dev/config/
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [
tanstackRouter({
target: "react",
autoCodeSplitting: true,
}),
react(),
],
build: {
target: "chrome86",
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
proxy: {
"/api": {
// target: "http://192.168.71.2:8080/", // 家
// target: "http://192.168.1.36:8080/", // 公司
target: "http://localhost:8080/", // 本地Docker测试
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
}
},
},
});