gpt4 book ai didi

javascript - 模块构建失败: TypeError: The plugin "transform-runtime" didn't export a Plugin instance

转载 作者:行者123 更新时间:2023-11-27 22:30:21 25 4
gpt4 key购买 nike

将 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com