I have to deploy locally to environments for development, test, and production so that also I have .env, .env.development and .env.test.
This is my package json
"scripts": {
"serve": "vue-cli-service serve",
}
How can I deploy locally for different environments by reading .env or .env.development or .env.test?
so far i am typing this "yarn serve " for development
EDIT 1:
To deploy to test i did this:
"serve:": "vue-cli-service build --mode test"
But i did not created the enviroment file .env.test but its working, should not worked, firstly should read the corresponding file.
CodePudding user response:
You can use the --mode production, --mode development, --mode staging etc. when building.
So the entire command would be vue-cli-service build --mode production (or any other environment instead of production)
Here is a link to the documentation about modes and environment variables :) https://cli.vuejs.org/guide/mode-and-env.html
