Problem Description:
When compiling es6 with babel, I encountered the error Uncaught ReferenceError: regeneratorRuntime is not defined
cause:
- The script uses ES7's async / await
- regeneratorRuntime is not known on the browser, you need to install @ babel / plugin-transform-runtime plugin
solution:
- Install @ babel / plugin-transform-runtime plugin
npm install @babel/plugin-transform-runtime --save-dev
Finally, modify the "plugins" in the .babelrc file: ["@ babel / plugin-transform-runtime"]