作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
将 Babel 与 Webpack 结合使用,并尝试让生成器在一些 React 代码中工作。尝试使用 babel-runtime 和 babel-plugin-transform-runtime 来启用 ES6 生成器,但在启动本地时收到以下错误消息开发服务器:
模块构建失败:类型错误:插件“transform-runtime”未导出插件实例
我的package.json
包含以下内容
"dependencies": {
...
"babel-core": "5.8.38",
"babel-loader": "5.0.0",
"babel-plugin-transform-runtime": "6.15.0",
"babel-preset-es2015": "6.14.0",
"babel-preset-react": "6.11.1",
"babel-preset-stage-2": "6.11.0",
"babel-runtime": "6.11.6",
...
}
我的webpack.config.js
包含以下内容
module: {
loaders: [
{
...
loader: 'babel-loader',
query: {
plugins: ['transform-runtime']
}
},
...
}
关于我做错了什么有什么想法吗?
最佳答案
"babel-runtime": "6.11.6",
对比
"babel-core": "5.8.38",
您的版本不匹配。由于您的大多数 deps 都是 Babel 6,因此您应该使用 babel-core@6,与 babel-loader 相同。
关于javascript - 模块构建失败: TypeError: The plugin "transform-runtime" didn't export a Plugin instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39648993/
我是一名优秀的程序员,十分优秀!