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
38 Replies
Bel
Bel•12mo ago
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
lab
lab•12mo ago
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
Bel
Bel•12mo ago
No description
Bel
Bel•12mo ago
thx for reply interesting thing that it works in my manifest exact the same env var
Bel
Bel•12mo ago
No description
Arcane
Arcane•12mo ago
@belarusrulez has reached level 2. GG!
Bel
Bel•12mo ago
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
lab
lab•12mo ago
shockedpikachu could it be due to the latest change to the env parsing...
Bel
Bel•12mo ago
I checked on few versions even 0.67
lab
lab•12mo ago
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
lab
lab•12mo ago
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
Bel
Bel•12mo ago
Funny thing it was working few weeks back I had few env vars that were filling up and working ok
lab
lab•12mo ago
By the look of it, it looks like an index.js - is it imported into background.ts? hmm...
Bel
Bel•12mo ago
Ill try to revert my code for few weeks
lab
lab•12mo ago
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?
Want results from more Discord servers?
Add your server