DEV Community


How to fix regeneratorRuntime is not defined?

Front End Developer
・1 min read

I have ran into a problem, the error is regeneratorRuntime is not defined while working with React and Parcel bundler.

Alt Text

The problem appeared after I added an async function and while searching the problem, I found a stack-overflow solution but it didn't work. So, don't use this method.


First, I found this solution:

  • add import "babel-polyfill"; at the top of the file that you are using the async function.


  • later learned that babel-polyfill is deprecated. So, to solve the regeneratorRuntime problem, do this:

  • Install regenerator-runtime
    npm install --save regenerator-runtime

  • Update webpack file
    entry: ["regenerator-runtime/runtime.js", "<your enter js file>"]

  • require import 'regenerator-runtime/runtime' at the top of the file that you're using async function

I didn't edit webpack, because I'm using Parcel, but just importing regenerator-runtime/runtime at the top of the file solved the problem.


BABEL/ReferenceError regeneratorRuntime is not defined #9849

Discussion (5)

enraiha0307 profile image
Akanksha Gahalot

Thank you soooo much!!! You saved me!

hulyakarakaya profile image
Hulya Author

Happy to help 👍

vitomedlej profile image

thanks man u saved my keyboard from being smashed

hulyakarakaya profile image
Hulya Author

Haha, good for the keyboard 😃

prosperdoescode profile image
Prosper Nglazi

Hi, now am getting a 'process not defined' error because in my file am using 'process.env.API_URL' to create a base url to the server. How can I solve this? Thanks