Cohars Cohars - 2 months ago 27
Javascript Question

Babel ignore several directories

I'm currently running Babel with a simple command :

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


But I can't find a way to ignore several directories (node_modules, test), I tried a lot of things, including (in
.babelrc
):

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


Which doesn't work at all (node_modules are transpiled). Isn't there a simple way to achieve this (with Babel 6)?

Answer

You should be able to use commas in the cli

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