如何从子包中获取 .babelrc?

How to get .babelrc from sub package?

如何从子包中获取.babelrc?我不希望它成为我的主要包裹。我想要 node_modules/mySubPackage/node_modules.

谢谢。

你可以使用 babelrcroots, 来自文档:

By default, Babel will only search for .babelrc files within the "root" package

.....

This option allows users to provide a list of other packages that should be considered "root" packages when considering whether to load .babelrc files.