2024-01-19 19:20:59 +08:00
|
|
|
import react from "@vitejs/plugin-react";
|
2022-12-18 21:18:30 +08:00
|
|
|
import { resolve } from "path";
|
2021-12-08 23:43:52 +08:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
2024-02-05 21:37:43 +08:00
|
|
|
let devProxyServer = "http://localhost:8081";
|
2023-05-29 19:49:47 +08:00
|
|
|
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;
|
|
|
|
}
|
2023-03-01 19:50:43 +08:00
|
|
|
|
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: {
|
2022-12-11 18:38:29 +08:00
|
|
|
"^/api": {
|
2023-03-01 19:50:43 +08:00
|
|
|
target: devProxyServer,
|
2023-09-15 21:49:34 +08:00
|
|
|
xfwd: true,
|
2021-12-08 23:43:52 +08:00
|
|
|
},
|
2024-04-28 00:44:29 +08:00
|
|
|
"^/memos.api.v1": {
|
2023-09-28 18:45:45 +08:00
|
|
|
target: devProxyServer,
|
|
|
|
xfwd: true,
|
|
|
|
},
|
2024-05-02 21:28:06 +08:00
|
|
|
"^/file": {
|
2023-03-01 19:50:43 +08:00
|
|
|
target: devProxyServer,
|
2023-09-15 21:49:34 +08:00
|
|
|
xfwd: true,
|
2022-09-09 07:40:21 +08:00
|
|
|
},
|
2021-12-08 23:43:52 +08:00
|
|
|
},
|
|
|
|
},
|
2022-12-18 21:18:30 +08:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@/": `${resolve(__dirname, "src")}/`,
|
|
|
|
},
|
|
|
|
},
|
2021-12-08 23:43:52 +08:00
|
|
|
});
|