I don't like placing all .env files in porject root , it makes my project structure look lengthy, can i make a directory to place them in it ?

I can config it in vue.config.js
@LinusBorg I'm working on it and I thought to add a new option environmentsDir into vue.config.js.
Is it a good solution ?
Because I have just seen that it's possible to change the vue.config.js location using an env variable (process.env.VUE_CLI_SERVICE_CONFIG_PATH) and I need to load environment files after vue.config.js.
might be a nice idea, yes.
Our overall guideline is - all CLI projects should have consistent file structures as much as possible. The CLI is opinionated by nature. This is why we do not provide options for configuring source directory or public directory names. If we add an option for this we essentially need to add options for renaming every possible config file and directory, and that would
Hello giving second thought of this.
As in my project structure, it's a monorepo that contain backend API and frontend website together.
my-project/
--server/ (node app)
--client/ (vue-cli)
Both may share the same variable, thus it's best if they can refer to the same .env. So my thought is to put the .env file in the root of the project folder:
my-project/
-- server/ (node app)
-- client/ (vue-cli)
-- .env
So, if it's related to the discussion here, can the vue-cli compiler in folder client still able to retrieve the env value from the root directory?
If there's a better suggestion to resolve this, please share ;)
I have the exact same issue as @chenxeed
As a workaround I installed node-env-run as a dev dependency, and now my dev script looks like:
"dev": "nodenv --env ../../.env --exec 'vue-cli-service serve'",
Not ideal but works for now.
Most helpful comment
I have the exact same issue as @chenxeed
As a workaround I installed node-env-run as a dev dependency, and now my dev script looks like:
"dev": "nodenv --env ../../.env --exec 'vue-cli-service serve'",Not ideal but works for now.