简体   繁体   English

如何使用异步等待与 webpack 和 typescript 反应?

[英]How to use async await with webpack and typescript in react?

I'm getting this error: regeneratorRuntime is not defined我收到此错误:未定义 regeneratorRuntime

My babel.config.js file:我的 babel.config.js 文件:

https://www.codepile.net/pile/XqDxeAq6 https://www.codepile.net/pile/XqDxeAq6

My webpack.config.js file我的 webpack.config.js 文件

https://www.codepile.net/pile/5ndebjVq https://www.codepile.net/pile/5ndebjVq

Install the runtime dependency:安装运行时依赖项:

npm i --save-dev @babel/plugin-transform-runtime

Add the plugin to your babel configuration:将插件添加到您的 babel 配置中:

{
  "plugins": ["@babel/plugin-transform-runtime"]
}

Uncaught ReferenceError: regeneratorRuntime is not defined in React 未捕获的 ReferenceError:RegeneratorRuntime 未在 React 中定义

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM