2025-12-10 19:14:07 +00:00
|
|
|
import { defineConfig, type Plugin } from "vite";
|
2024-10-17 12:05:06 +08:00
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
|
import svgr from "vite-plugin-svgr";
|
2025-09-25 16:06:52 -07:00
|
|
|
import path from "path";
|
2025-09-26 14:32:16 -07:00
|
|
|
import { fileURLToPath } from "url";
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
|
|
|
const __dirname = path.dirname(__filename);
|
2024-05-03 12:29:37 -04:00
|
|
|
|
2025-12-10 19:14:07 +00:00
|
|
|
const publicReload = (): Plugin => ({
|
|
|
|
|
name: "public-reload",
|
|
|
|
|
configureServer(server) {
|
|
|
|
|
// Watch all files under public and trigger a full reload on change
|
|
|
|
|
server.watcher.add("public/**");
|
|
|
|
|
const reload = () => server.ws.send({ type: "full-reload" });
|
|
|
|
|
server.watcher.on("add", reload);
|
|
|
|
|
server.watcher.on("change", reload);
|
|
|
|
|
server.watcher.on("unlink", reload);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-13 13:47:26 -08:00
|
|
|
export default defineConfig(() => {
|
|
|
|
|
return {
|
|
|
|
|
base: "/",
|
2025-12-10 19:14:07 +00:00
|
|
|
plugins: [svgr(), react(), publicReload()],
|
2025-11-13 13:47:26 -08:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
"@": path.resolve(__dirname, "src"),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
optimizeDeps: {
|
|
|
|
|
include: ["@mui/material/Tooltip", "@emotion/styled"],
|
|
|
|
|
},
|
|
|
|
|
};
|
2024-10-17 12:05:06 +08:00
|
|
|
});
|