question:
When using it, the value of the environment variable cannot be obtained:
= .VUE_APP_BASE_API;
solve:
1: In the . and . environment configuration files in the project root directory, the value of NODE_ENV=development must be consistent with the file startup configuration-mode
//.
NODE_ENV=development
VUE_APP_BASE_API=/api
VUE_APP_BASE_URL=http://localhost:8081/
VUE_APP_PROXYURL=http://localhost:8080/
"scripts": { "serve": "vue-cli-service serve", "dev": "vue-cli-service serve --mode development", "prod": "vue-cli-service serve --mode production", },
2: The variable names in the environment configuration file must start with VUE_APP_
Summarize
This is the end of this article about the solution to the vue3 environment variable not taking effect. For more related content about vue3 environment variable not taking effect, please search for my previous article or continue browsing the related articles below. I hope everyone will support me in the future!