Graphics Cove

Babel 7 - ReferenceError regeneratorRuntime is not defined

In one of my ReactJS applications I encountered an error during build with a Yarn/Babel setup: Babel 7 - ReferenceError: regeneratorRuntime is not defined.

If you are using Babel 7.4.0 or newer, then @babel/polyfill has been deprecated. Instead, you need to use core-js/stable and regenerator-runtime/runtime. These can be added with Yarn:

yarn add core-js
yarn add regenerator-runtime

Import them as follows in your main javascript file:

import 'core-js/stable'
import 'regenerator-runtime/runtime'

© 2010 - 2023 Graphicscove

TwitterFacebookFAQsPrivacy PolicyFree Website Review