mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 07:28:09 -05:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import { defineConfig, PluginOption } from "vite";
|
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
|
import topLevelAwait from "vite-plugin-top-level-await";
|
|
import wasm from "vite-plugin-wasm";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
const virtualRouteFileChangeReloadPlugin: PluginOption = {
|
|
name: "watch-config-restart",
|
|
configureServer(server) {
|
|
server.watcher.add("./src/routes.ts");
|
|
server.watcher.on("change", (path) => {
|
|
if (path.endsWith("src/routes.ts")) {
|
|
console.log("Virtual route changed");
|
|
server.restart();
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
server: {
|
|
host: true,
|
|
port: 3000
|
|
// proxy: {
|
|
// "/api": {
|
|
// target: "http://localhost:8080",
|
|
// changeOrigin: true,
|
|
// secure: false,
|
|
// ws: true
|
|
// }
|
|
// }
|
|
},
|
|
plugins: [
|
|
tsconfigPaths(),
|
|
nodePolyfills({
|
|
globals: {
|
|
Buffer: true
|
|
}
|
|
}),
|
|
wasm(),
|
|
topLevelAwait(),
|
|
TanStackRouterVite({
|
|
virtualRouteConfig: "./src/routes.ts"
|
|
}),
|
|
react(),
|
|
virtualRouteFileChangeReloadPlugin
|
|
]
|
|
});
|