1.0.2 • Published 2 years ago
vuepress-plugin-env-define v1.0.2
vuepress-plugin-env-define
使用方法
安装 npm install vuepress-plugin-env-define
package.json 文件中配置
{
"scripts": {
"docs:dev": "vuepress dev docs",
"build:dev": "vuepress build docs",
"build:test": "vuepress build docs",
"build:prod": "vuepress build docs"
}
}
- 在 docs 目录下新增.env 文件 例如: .env.dev、.env.test、.env.prod 并在文件中配置环境变量
.env # 在所有的环境中被载入
.env.local # 在所有的环境中被载入,但会被 git 忽略
.env.[mode] # 只在指定的模式中被载入
.env.[mode].local # 只在指定的模式中被载入,但会被 git 忽略
- 在 config.js 文件中配置插件
module.exports = {
plugins: ["env-define"],
};