2023-03-05 14:16:12 -05:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
import path from "node:path";
|
|
|
|
|
|
|
|
const { MCL_VITE_BACKEND_URL, MCL_VITE_DEV_PORT } = process.env;
|
|
|
|
const backendUrl = MCL_VITE_BACKEND_URL ?? "http://localhost:52000";
|
|
|
|
const vitePort = MCL_VITE_DEV_PORT ?? 52025;
|
2023-08-21 20:49:38 +00:00
|
|
|
|
2023-03-05 14:16:12 -05:00
|
|
|
export default () => {
|
|
|
|
return defineConfig({
|
|
|
|
plugins: [react()],
|
|
|
|
server: {
|
|
|
|
host: "0.0.0.0",
|
|
|
|
port: vitePort,
|
|
|
|
proxy: {
|
|
|
|
"/api": backendUrl,
|
|
|
|
"/socket.io": backendUrl,
|
|
|
|
},
|
|
|
|
hmr: {
|
2023-03-15 15:20:08 +00:00
|
|
|
protocol: process.env.MCL_VITE_DEV_PROTOCOL,
|
2023-03-05 14:16:12 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
outDir: "./build",
|
|
|
|
},
|
|
|
|
base: "/mcl/",
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-10-09 13:42:11 -06:00
|
|
|
"@mcl/css": path.resolve("./src/css"),
|
2023-03-15 15:20:08 +00:00
|
|
|
"@mcl/settings": path.resolve("./src/ctx/SettingsContext.jsx"),
|
|
|
|
"@mcl/pages": path.resolve("./src/pages"),
|
|
|
|
"@mcl/queries": path.resolve("./src/util/queries.js"),
|
2023-10-09 13:42:11 -06:00
|
|
|
"@mcl/components": path.resolve("./src/components"),
|
2023-03-05 14:16:12 -05:00
|
|
|
"@mcl": path.resolve("./src"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|