#How to access ENVs in plugin in Admin Widget

4 messages · Page 1 of 1 (latest)

spiral gazelle
#

I have a medusa 2.0 plugin where I have an Admin UI page with Widget. On widget I want to access some envs from host app at runtime.

I tried to use this:

const appId = import.meta.env.VITE_CHAT_APP_ID;
const authKey = import.meta.env.VITE_CHAT_AUTH_KEY;

But obviously it's empty because when build and push plugin I do not pass any envs so the Vite replaces this envs with void 0 during build

Any working way to reads host app envs in plugin's widget at runtime?

ripe mantle
robust swan
spiral gazelle
#

@ripe mantle that is the thing - It does not work when you want to read envs in plugin in UI widget