2022-12-18 16:18:30 +03:00
|
|
|
import { resolve } from "path";
|
2021-12-08 18:43:52 +03:00
|
|
|
import { defineConfig } from "vite";
|
2022-12-11 13:38:29 +03:00
|
|
|
import react from "@vitejs/plugin-react-swc";
|
2021-12-08 18:43:52 +03:00
|
|
|
|
2023-05-29 14:49:47 +03:00
|
|
|
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;
|
|
|
|
}
|
2023-03-01 14:50:43 +03:00
|
|
|
|
2021-12-08 18:43:52 +03:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2023-01-25 19:35:50 +03:00
|
|
|
plugins: [react()],
|
2021-12-08 18:43:52 +03:00
|
|
|
server: {
|
2022-09-09 02:40:21 +03:00
|
|
|
host: "0.0.0.0",
|
2022-12-25 05:39:45 +03:00
|
|
|
port: 3001,
|
2021-12-08 18:43:52 +03:00
|
|
|
proxy: {
|
2022-12-11 13:38:29 +03:00
|
|
|
"^/api": {
|
2023-03-01 14:50:43 +03:00
|
|
|
target: devProxyServer,
|
2021-12-08 18:43:52 +03:00
|
|
|
changeOrigin: true,
|
|
|
|
},
|
2022-12-11 13:38:29 +03:00
|
|
|
"^/o/": {
|
2023-03-01 14:50:43 +03:00
|
|
|
target: devProxyServer,
|
2022-09-09 02:40:21 +03:00
|
|
|
changeOrigin: true,
|
|
|
|
},
|
2022-10-26 15:13:02 +03:00
|
|
|
"^/u/\\d*/rss.xml": {
|
2023-03-01 14:50:43 +03:00
|
|
|
target: devProxyServer,
|
2022-10-26 15:13:02 +03:00
|
|
|
changeOrigin: true,
|
|
|
|
},
|
2023-02-09 16:17:15 +03:00
|
|
|
"/explore/rss.xml": {
|
2023-03-01 14:50:43 +03:00
|
|
|
target: devProxyServer,
|
2023-02-09 16:17:15 +03:00
|
|
|
changeOrigin: true,
|
|
|
|
},
|
2021-12-08 18:43:52 +03:00
|
|
|
},
|
|
|
|
},
|
2022-12-18 16:18:30 +03:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@/": `${resolve(__dirname, "src")}/`,
|
|
|
|
},
|
|
|
|
},
|
2021-12-08 18:43:52 +03:00
|
|
|
});
|