Use .babelrc from different path

纵然是瞬间 提交于 2019-12-23 11:43:06

问题


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

回答1:


Considering the version you are using you may try extends or babelrc

http://henryzoo.com/babel.github.io/docs/usage/options/




回答2:


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.



来源:https://stackoverflow.com/questions/38520862/use-babelrc-from-different-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!