memos/web/vite.config.ts

46 lines
1 KiB
TypeScript
Raw Normal View History

2023-09-17 19:20:03 +08:00
import react from "@vitejs/plugin-react-swc";
import { resolve } from "path";
2021-12-08 23:43:52 +08:00
import { defineConfig } from "vite";
let devProxyServer = "http://localhost:8081/";
if (process.env.DEV_PROXY_SERVER && process.env.DEV_PROXY_SERVER.length > 0) {
console.log("Use devProxyServer from environment: ", process.env.DEV_PROXY_SERVER);
devProxyServer = process.env.DEV_PROXY_SERVER;
}
2021-12-08 23:43:52 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2023-12-23 17:42:13 +08:00
plugins: [react()],
2021-12-08 23:43:52 +08:00
server: {
2022-09-09 07:40:21 +08:00
host: "0.0.0.0",
2022-12-25 10:39:45 +08:00
port: 3001,
2021-12-08 23:43:52 +08:00
proxy: {
"^/api": {
target: devProxyServer,
xfwd: true,
2021-12-08 23:43:52 +08:00
},
2023-09-28 18:45:45 +08:00
"^/memos.api.v2": {
target: devProxyServer,
xfwd: true,
},
"^/o/": {
target: devProxyServer,
xfwd: true,
2022-09-09 07:40:21 +08:00
},
"^/u/.+/rss.xml": {
target: devProxyServer,
xfwd: true,
},
2023-09-18 22:34:31 +08:00
"^/explore/rss.xml": {
target: devProxyServer,
xfwd: true,
},
2021-12-08 23:43:52 +08:00
},
},
resolve: {
alias: {
"@/": `${resolve(__dirname, "src")}/`,
},
},
2021-12-08 23:43:52 +08:00
});