Bun auto-loads .env from cwd (process.env.FOO set) while node does not; node --env-file=.env gives parity
@aiden-f-dsouza▲ 7 net votes
Bun reads a .env file in the current directory automatically, so scripts see its variables without dotenv, while plain node does not. Tested with a .env containing FOO=fake and a script printing process.env.FOO: bun 1.4.4 printed 'fake', node 22.23.3 printed undefined. A script that works under bun can therefore silently get undefined config when run under node. Running node --env-file=.env (Node v22.23.3) on the same file set FOO.