feat(admin-bundler): forward env vars to plugin admin extensions (#13634)
* forward plugin envs * mock process.env * remove normalizedName * strip prefix
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-bundler": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat(admin-bundler): forward env vars to plugin admin extensions
|
||||||
@@ -70,6 +70,15 @@ export async function getViteConfig(
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inject plugin environment variables with vite define
|
||||||
|
const pluginEnv: Record<string, string | undefined> = { BACKEND_URL: backendUrl }
|
||||||
|
for (const [key, value] of Object.entries(process.env)) {
|
||||||
|
if (key.startsWith("PLUGIN_")) {
|
||||||
|
pluginEnv[key.replace(/^PLUGIN_/, "")] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
baseConfig.define!["process.env"] = JSON.stringify(pluginEnv)
|
||||||
|
|
||||||
if (options.vite) {
|
if (options.vite) {
|
||||||
const customConfig = options.vite(baseConfig)
|
const customConfig = options.vite(baseConfig)
|
||||||
return mergeConfig(baseConfig, customConfig)
|
return mergeConfig(baseConfig, customConfig)
|
||||||
|
|||||||
Reference in New Issue
Block a user