There are two ways to build a vue project:
1. Vuecli scaffolding construction
2. Webpack construction
Among them, use method one to build, and the environment variable configuration needs to create a file named vue.config.js for configuration.
Use method two to configure environment variables are as follows:
Step 1: Create dev.env.js in the root directory File, prod.env.js file, test.env.js file and index.js file
Step 2: Configure each file
index.js
dev.env.js
test.env.js
prod.env.js
3. Configure the packjson.js file.
Reference article: https://blog.csdn.net/weixin_33840661/article/details/91393068