+
+ API Key: {import.meta.env.MY_API_KEY}
+
+
+ )
+}
+
+export const config = defineWidgetConfig({
+ zone: "product.details.before",
+})
+
+export default ProductWidget
+```
+
+Then, in the Medusa application that uses the plugin, set the environment variable with the `PLUGIN_` prefix:
+
+```bash
+PLUGIN_MY_API_KEY=sk_123
+```
+
+The `MY_API_KEY` environment variable in the plugin will be replaced with the value of `PLUGIN_MY_API_KEY` during the build process of the Medusa application.
+
+### Global Variables in Plugins
+
+Plugins also have the following global variables available:
- `__BACKEND_URL__`: The URL of the Medusa backend, as set in the [Medusa configurations](../../../configurations/medusa-config/page.mdx#backendurl).
- `__BASE__`: The base path of the Medusa Admin. (For example, `/app`).
@@ -137,4 +176,14 @@ To fix possible type errors, create the file `src/admin/vite-env.d.ts` and add t
declare const __BACKEND_URL__: string
declare const __BASE__: string
declare const __STOREFRONT_URL__: string
-```
\ No newline at end of file
+```
+
+### For Medusa versions prior to v2.11.0
+
+