能不能把babel7 打出的包给 babel6的项目使用?

因为一些原因 两个项目 不能更改为统一的版本。

我在 babel7的 项目中
 "babel src -d lib "
这样进行编译, 并在 babel6的项目中引入,之后使用webpack打包 ,但是 会提示
Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core"
or "babel-core" to see what is calling Babel.
能够让babel7的项目编译出 babel6项目可以使用的js吗?

阅读 2.7k
2 个回答

如果是已经用babel编译的模块,可以直接在项目中引入,无需再做一次babel编译,可以将此目录加到babel6项目中的过滤配置里

hello,请问你解决了吗,我也遇到这个问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题