Shell 如何有条件地设置.rc文件
我正在使用Shell 如何有条件地设置.rc文件,shell,heroku,babeljs,rc,Shell,Heroku,Babeljs,Rc,我正在使用babel,并且有一个.babelrc文件用于其配置: { "stage": 0, "ignore": [ "node_modules", "bower_components", "testing", "test" ] } 但是,当我在本地开发时,拥有这个.babelrc文件将禁止我运行testing文件夹中的Babel的CLIBabel节点(请参阅:) 也就是说,当我推到Heroku时,我需要这个配置,因为我需要确保测试文件夹没有被编译
babel
,并且有一个.babelrc
文件用于其配置:
{
"stage": 0,
"ignore": [
"node_modules",
"bower_components",
"testing",
"test"
]
}
但是,当我在本地开发时,拥有这个.babelrc
文件将禁止我运行testing
文件夹中的Babel的CLIBabel节点
(请参阅:)
也就是说,当我推到Heroku时,我需要这个配置,因为我需要确保测试文件夹没有被编译
我如何有条件地设置
.babelrc
文件,而不需要每次我想推送到Heroku时都记得将其切换回生产版本?您可以使用中的env
选项设置有条件的内容
发件人:
然后,在您的package.json中
"scripts": {
"start": "NODE_ENV=production node index.js",
"dev": "NODE_ENV=development node index.js"
}
它检查BABEL_ENV,然后检查NODE_ENV
"scripts": {
"start": "NODE_ENV=production node index.js",
"dev": "NODE_ENV=development node index.js"
}