Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个cli项目和一个boilerplate项目。现在我想将所有 babel 插件和预设cli安装cli在boilerplate.
cli
boilerplate
问题是,我想在样板目录中运行 cli 命令,而 babel 总是从样板/node_modules 而不是 cli/node_modules 中查找插件/预设。
如何将 babel 配置为仅搜索 cli/node_modules?我尝试设置sourceRootand moduleRoot,但都不起作用。
sourceRoot
moduleRoot
您可以显式传递已解析的插件,例如
transform(code, { preset: [require('babel-preset-es2015')], });