question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New REPL doesn't include regenerator runtime

See original GitHub issue

While 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:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bvaughncommented, Aug 29, 2017

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. 😄

1reaction
bvaughncommented, Aug 29, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found