Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 462
Cohars Avatar asked Mar 02 '16 13:03

Cohars


People also ask

How do I ignore files in Babel?

Try it via command line flag --ignore and you'll noticed the glob pattern is honored. I tried the workaround with CLI, and I just noticed that ' on both side of **/*. test.

What is Babelrc?

The . babelrc file is your local configuration for your code in your project. Generally you would put it in the root of your application repo. It will affect all files that Babel processes that are in the same directory or in sibling directories of the . babelrc .


Video Answer


1 Answers

You should be able to use commas in the cli

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

like image 52
hzoo Avatar answered Sep 16 '22 14:09

hzoo