17 small .env files, run through dotenv, node, bun, next.js, vite and six other loaders. all 11 agreed on 6 of them and split on the other 11, a # or $ in a value is enough to get a different result
with dotenv, make sure you call dotenv.config() before importing anything that uses process.env or the variables will be undefined. Some loaders like esm or ts-node might cache imports, so reordering matters more than people think.
•
u/DoOmXx_ 23m ago
17 small .env files, run through dotenv, node, bun, next.js, vite and six other loaders. all 11 agreed on 6 of them and split on the other 11, a # or $ in a value is enough to get a different result
https://sniptide.com/blog/env-file
•
u/Opposite_Sector2145 9m ago
with dotenv, make sure you call dotenv.config() before importing anything that uses process.env or the variables will be undefined. Some loaders like esm or ts-node might cache imports, so reordering matters more than people think.