New REPL doesn't include regenerator runtime
See original GitHub issueWhile the new REPL does include transform-regenerator
, it doesn’t use the regenerator runtime to be able to run async functions and generators:
(async () => {})()
outputs the following:
"use strict";
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
case "end":
return _context.stop();
}
}
}, _callee, undefined);
}))();
which throws:
regeneratorRuntime is not defined
This works fine in the old REPL.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Regenerator runtime error when using react-router-dom in react
I am trying to install the react-router-dom package to my react application and when I try to wrap BrowserRoute around my App component....
Read more >How to fix regeneratorRuntime is not defined?
First, I found this solution: add import "babel-polyfill"; at the top of the file that you are using the async function. BUT.
Read more >Parcel, how to fix the `regeneratorRuntime is not defined` error
I run into this problem in a project using Babel as soon as I added an async function, but the problem is the...
Read more >retejs/Lobby - Gitter
Hi! Awesome work! I got a question, I am using rete within a Vue app, and I am trying to upload a json...
Read more >Miscellaneous developer focused changes in WordPress 5.8
Update on July 1, 2021: Added new filter info in Revisions section. ... It is recommended that developers add the regenerator-runtime script as...
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
I think a better solution would be to just load the runtime polyfill directly into the iframe we’re evaling in. I’ll look into making this change soon. 😄
We lazy-load
babel-polyfill
(which includes the regenerator runtime) if you check “Evaluate”.Or at least we are supposed to. This worked at some point 😅 I’ll look into it.