ReferenceError: regeneratorRuntime babel-present-env error?
See original GitHub issueI think this may be a bug with babel-preset-env
, just checking here first. I’m getting the error below when trying to run the tests for a new exercise I’m implementing. This error refers to this line: function* generate(A) {
. Generator functions are part of the babel-preset-es2015
which should be included in babel-preset-env
so I’m not sure why this is happening. Any ideas? Thanks!
● Test suite failed to run
ReferenceError: regeneratorRuntime is not defined
at Object.<anonymous> (exercises/alphametics/tmp/alphametics.js:57:15)
at Object.<anonymous> (exercises/alphametics/tmp/temp.alphametics.spec.js:1:122)
Test Suites: 1 failed, 1 total
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Babel 7 - ReferenceError: regeneratorRuntime is not defined
I just encountered this problem and came across the following solution: ... npm i --save-dev @babel/preset-env npm i regenerator-runtime ...
Read more >ReferenceError regeneratorRuntime is not defined · Issue #9849
I'm building an SSR template, and when I use @babebl/register and then execute webpack (config), the system reported an error.
Read more >How to fix regeneratorRuntime is not defined?
I have ran into a problem, the error is regeneratorRuntime is not defined while working with React and Parcel bundler.
Read more >babel/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >7 - still "ReferenceError: regeneratorRuntime is not defined"
npm install --save-dev @babel/plugin-transform-runtime. But still, I get the error: ReferenceError: regeneratorRuntime is not defined.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rchavarria You are right, after adding the babel-polyfil the error has gone away. Thanks for your help!
I have no idea about how to configure Babel nowadays (I did it in the past, but it has evolved a lot since then).
But just looking at the documentation, if I compare the support for arrow functions (a basic feature that makes sense to be included by default) to generators (a not so basic feature) I notice a difference:
The generators documentation shows a warning:
It seems if we want to use generators we need a plugin.