There are three main ways to configure environment variables in uni-app project:

# vue-config.js

The webpack configuration can be modified in vue.config.js, including environment variables. For details, please refer to vue-config.js.

# package.json

When customizing the conditional compilation platform, you can configure environment variables under the env node of the package.json file. For details, please refer to package.json

# .env

In the project created by CLI, you can place a .env file in the root directory to specify environment variables. For details, please refer to: Environment Variables (opens new window).