Describe the bug
I am using a configuration feature outlined in this PR #4321 to only inject specific .env files into my functions, but not my Vite environment.
My netlify.toml has the following
[dev]
envFiles = [".env.netlify", ".env.netlify.local"]
When I run netlify dev I get the following.

Notice the .env.netlify.local is being ignored in favour of the .env.netlify variables, which get injected. Some .env.netlify.local variables are injected, but they have no counterpart in the .env.netlify file.
I was on "netlify-cli": "^9.13.6" and also tried it on "netlify-cli": "^10.0.0" but both seem to have this issue.
Steps to reproduce
- create a new project
- initialize netlify-cli
- create
.env.netlify and .env.netlify.local files
- put
SOME_VAR=prod and SOME_VAR=local in each file respectively
- edit
netlify.toml to include envFiles = [".env.netlify", ".env.netlify.local"] setting under [dev]
- run
netlify dev
- observe the
.env.netlify.local variable being ignored and the .env.netlify being injected
Configuration
[dev]
envFiles = [".env.netlify", ".env.netlify.local"]
Environment
System:
OS: Linux 4.19 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
Memory: 43.23 GB / 50.14 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.16.0 - /mnt/c/Users/Ian/AppData/Roaming/npm/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: 2021.06.07.00 - /home/linuxbrew/.linuxbrew/bin/watchman
npmPackages:
netlify-cli: ^10.0.0 => 10.0.0
Describe the bug
I am using a configuration feature outlined in this PR #4321 to only inject specific .env files into my functions, but not my Vite environment.
My
netlify.tomlhas the followingWhen I run
netlify devI get the following.Notice the
.env.netlify.localis being ignored in favour of the.env.netlifyvariables, which get injected. Some.env.netlify.localvariables are injected, but they have no counterpart in the.env.netlifyfile.I was on
"netlify-cli": "^9.13.6"and also tried it on"netlify-cli": "^10.0.0"but both seem to have this issue.Steps to reproduce
.env.netlifyand.env.netlify.localfilesSOME_VAR=prodandSOME_VAR=localin each file respectivelynetlify.tomlto includeenvFiles = [".env.netlify", ".env.netlify.local"]setting under[dev]netlify dev.env.netlify.localvariable being ignored and the.env.netlifybeing injectedConfiguration
Environment