process.env is empty
I am using env vars
I created
//.env.development
PLASMO_PUBLIC_WEB_SITE_URL=VALUE
I can use this value in package.json but can't load anything in code. It's empty
![No description](https://cdn.answeroverflow.com/1155326063249989703/image.png)
38 Replies
It used to work but now it's not.
I run with regular pnpm dev
I tried on 0.82.1
0.82.6
0.83.0
if you do
console.log(process.env.PLASMO_PUBLIC_WEB_SITE_URL)
, does it work?
the process.env object is partial populated but it's just for dev server polyfill
The env itself will be statically replaced in the final bundle![No description](https://cdn.answeroverflow.com/1155632262977683526/image.png)
thx for reply
interesting thing that it works in my manifest
exact the same env var
![No description](https://cdn.answeroverflow.com/1155633071706607636/image.png)
@belarusrulez has reached level 2. GG!
I can see changes if I change PLASMO_PUBLIC_WEB_SITE_URL in .env.development and readd extension
so It's definetelly works in package.json
![shockedpikachu](https://cdn.discordapp.com/emojis/923058812464803873.png)
I checked on few versions
even 0.67
Older version has to work tho :d..
Where's this file located btw?
How is it being imported? Only files that were statically analyzed and compiled by plasmo woud get the env injected
Can you try replicating the issue in https://github.com/PlasmoHQ/examples/tree/main/with-env
GitHub
examples/with-env at main · PlasmoHQ/examples
🔰 Example projects that demonstrate how to use the Plasmo Framework and integrate with popular tools - PlasmoHQ/examples
Funny thing it was working few weeks back
I had few env vars that were filling up and working ok
By the look of it, it looks like an
index.js
- is it imported into background.ts
?
hmm...Ill try to revert my code for few weeks
try doing
--verbose
and look at the first few lines of log, see if it recognize your env
It could also be that
one of the env was malformed
which botched the rest of the env file
if you isolate just 1 string env, does it work?