网上有很多解决办法,但都不尽如人意。这里介绍一种比较好的兼容办法 需要引入插件 npm install babel-plugin-transform-es2015-modules-commonjs 然后在 babelrc中配置 { "plugins": ["transform-es2015-modules-commonjs"] } 即可解决
来源链接:https://www.jianshu.com/p/837e6b7d0ce0