mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
feat(vite.config): Allowed Hosts Defined Through Env Variable
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import { defineConfig, PluginOption } from "vite";
|
import { defineConfig, loadEnv, PluginOption } from "vite";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
import topLevelAwait from "vite-plugin-top-level-await";
|
import topLevelAwait from "vite-plugin-top-level-await";
|
||||||
import wasm from "vite-plugin-wasm";
|
import wasm from "vite-plugin-wasm";
|
||||||
@@ -20,32 +20,38 @@ const virtualRouteFileChangeReloadPlugin: PluginOption = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => {
|
||||||
server: {
|
const env = loadEnv(mode, process.cwd());
|
||||||
host: true,
|
const allowedHosts = env.VITE_ALLOWED_HOSTS?.split(",") ?? [];
|
||||||
port: 3000
|
|
||||||
// proxy: {
|
return {
|
||||||
// "/api": {
|
server: {
|
||||||
// target: "http://localhost:8080",
|
allowedHosts,
|
||||||
// changeOrigin: true,
|
host: true,
|
||||||
// secure: false,
|
port: 3000
|
||||||
// ws: true
|
// proxy: {
|
||||||
// }
|
// "/api": {
|
||||||
// }
|
// target: "http://localhost:8080",
|
||||||
},
|
// changeOrigin: true,
|
||||||
plugins: [
|
// secure: false,
|
||||||
tsconfigPaths(),
|
// ws: true
|
||||||
nodePolyfills({
|
// }
|
||||||
globals: {
|
// }
|
||||||
Buffer: true
|
},
|
||||||
}
|
plugins: [
|
||||||
}),
|
tsconfigPaths(),
|
||||||
wasm(),
|
nodePolyfills({
|
||||||
topLevelAwait(),
|
globals: {
|
||||||
TanStackRouterVite({
|
Buffer: true
|
||||||
virtualRouteConfig: "./src/routes.ts"
|
}
|
||||||
}),
|
}),
|
||||||
react(),
|
wasm(),
|
||||||
virtualRouteFileChangeReloadPlugin
|
topLevelAwait(),
|
||||||
]
|
TanStackRouterVite({
|
||||||
|
virtualRouteConfig: "./src/routes.ts"
|
||||||
|
}),
|
||||||
|
react(),
|
||||||
|
virtualRouteFileChangeReloadPlugin
|
||||||
|
]
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user