Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: import-meta-env crashes while using dev mode

Andrew Bastind09a3e92373e
diff --git a/packages/hoppscotch-selfhost-web/vite.config.ts b/packages/hoppscotch-selfhost-web/vite.config.ts
index e26605e0a..d17d7a6d3 100644
--- a/packages/hoppscotch-selfhost-web/vite.config.ts
+++ b/packages/hoppscotch-selfhost-web/vite.config.ts
@@ -242,9 +242,11 @@ export default defineConfig({
modernPolyfills: ["es.string.replace-all"],
renderLegacyChunks: false,
}),
- ImportMetaEnv.vite({
- example: "../../.env.example",
- env: "../../.env",
- }),
+ process.env.HOPP_ALLOW_RUNTIME_ENV
+ ? ImportMetaEnv.vite({
+ example: "../../.env.example",
+ env: "../../.env",
+ })
+ : [],
],
})
diff --git a/packages/hoppscotch-sh-admin/vite.config.ts b/packages/hoppscotch-sh-admin/vite.config.ts
index 9bea4bf32..26fef49dd 100644
--- a/packages/hoppscotch-sh-admin/vite.config.ts
+++ b/packages/hoppscotch-sh-admin/vite.config.ts
@@ -91,9 +91,11 @@ export default defineConfig({
],
}
}),
- ImportMetaEnv.vite({
- example: "../../.env.example",
- env: "../../.env",
- }),
+ process.env.HOPP_ALLOW_RUNTIME_ENV
+ ? ImportMetaEnv.vite({
+ example: "../../.env.example",
+ env: "../../.env",
+ })
+ : [],
],
});