Questions about vue-cli3.0 switching environment variables

  In the development of the project in general we need to distinguish between a variety of environments, sometimes not necessarily only development environment, production environment, test environment, there may be distinguished more environmental, so to distinguish these environments, we configured in multiple ways ;

  1: Direct only be distinguished with the environment and .env.development .env.production, each version of the hair when the modified value of the environment variable to be requisitioned;

  Second way: to distinguish by accessing the domain name server, the domain name is the same general project, to capture the current domain environment, then the variable will be able to handle it;

  Three ways: npm run dev distinguished by a command, we can create multiple .env.modeName file, add the appropriate command in package.json then add --mode = modeName to switch files

Guess you like

Origin www.cnblogs.com/mufc/p/11653890.html