如何在vue.js中创建多个.env [英] How to create multiple .env in vue.js
本文介绍了如何在vue.js中创建多个.env的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我陷入了vue.js的困境,如何为多个服务器(例如本地,开发和生产)管理多个环境?
I am stuck in vue.js, how to manage multiple env for multiple servers like local, development and production ?
推荐答案
您可以为不同的环境创建不同的.env文件,例如 .env.development
, .env.staging
和 .env.production
,并在package.json中创建这样的构建脚本->
you can create different .env file for different environment like
.env.development
, .env.staging
, and .env.production
and in your package.json create build script like this -
"scripts": {
"build-dev": "vue-cli-service build --mode development --modern",
"build-stage": "vue-cli-service build --mode staging --modern",
"build-prod": "vue-cli-service build --mode production --modern",
}
有关详细信息,请遵循此文档 https://cli.vuejs.org/guide/mode-and-env.html
For details please follow this doc https://cli.vuejs.org/guide/mode-and-env.html
这篇关于如何在vue.js中创建多个.env的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文