2016-03-02 119 views
12

我目前正在运行的巴贝尔用一个简单的命令:巴贝尔忽略的几个目录

$ babel . --ignore node_modules --out-dir dist 

但我不能找到一个办法忽略的几个目录(node_modules,测试),我尝试了很多东西,包括(在.babelrc):

"ignore": "node_modules" 
    "ignore": "/node_modules/" 
    "ignore": "node_modules/**" 
    "ignore": ["node_modules"] 

这并不在所有的工作(node_modules被transpiled)。有没有一种简单的方法来实现这一点(与Babel 6)?

+2

其在babel本身的错误。 https://phabricator.babeljs.io/T6726 –

+0

你可以做到这一点,如果你使用的是webpack –

+0

嗯,我没有在这里使用webpack ...并且我不能使用'--ignore'指定几个目录通过CLI选项? (再一次,我尝试了很多东西,但无法弄清楚。) – Cohars

回答

18

你应该能够在CLI

babel . --ignore node_modules,test --out-dir dist

3

注意,有通天一个已知的bug,它忽略了only.babelrcignore使用逗号。

相关错误是T6726,它已被fixed in babel 6.14.0

+0

你是什么意思?你能提供更多细节吗? – Green