38 lines
929 B
TypeScript
38 lines
929 B
TypeScript
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:8081/", // 本地后端(s-file, local-dev 配置)
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
|
}
|
|
},
|
|
},
|
|
});
|