vue-cli3 environment variables

Official documents are written like this:

src folder of the same name established under

.env [model] profile // mode:. production development ...

 

All command to load variables will vue-cli-service of, and dependent on the available plug-ins

https://cli.vuejs.org/zh/guide/mode-and-env.html#%E6%A8%A1%E5%BC%8F

 


Think about the principles which are to achieve, it should be:

Set a good key v variables will first be processed in the processing process webpack's, you can get direct process.env. Get,

The document said, if the variable is beginning VUE_APP_ will be placed in the client webpack.definePlugin

Alternatively string during compilation

To replace the corresponding values ​​process.env.VUE_APP_xxx

Guess you like

Origin www.cnblogs.com/eret9616/p/11027928.html
Recommended