Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use .babelrc from different path

Is there a way to provide the path to the .babelrc file to babel-cli? Something like:

babel src --out-dir lib --config random-folder/sub-folder/.babelrc
like image 895
Adrian Neatu Avatar asked Oct 29 '22 23:10

Adrian Neatu


1 Answers

You can put the .babelrc file in a shared parent directory of the other 5 modules as the lookup behavior of babel regarding the .babelrc is:

Babel will look for a .babelrc in the current directory of the file being transpiled. If one does not exist, it will travel up the directory tree until it finds either a .babelrc, or a package.json with a "babel": {} hash within.

like image 102
Ori Drori Avatar answered Nov 10 '22 06:11

Ori Drori