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.

Allow to disable regenerator-runtime

See original GitHub issue

With the current configuration, async is transpiled into generators. If I have an error in an async function, my VS Code with chrome-debugger extension loads bundle.js and jumps to _asyncToGenerator ... catch (error) { reject(error); return; } ... there which is quite laggy.

Exception has occurred: Error
Error
    at _callee3$ (/Users/anton/Work/abc/src/containers/src.js:125:1)
    at tryCatch (/Users/anton/Work/abc/node_modules/regenerator-runtime/runtime.js:62:1)
    at Generator.invoke [as _invoke] (/Users/anton/Work/campaign-design/node_modules/regenerator-runtime/runtime.js:296:1)
    at Generator.prototype.(anonymous function) [as next] (/Users/anton/Work/abc/node_modules/regenerator-runtime/runtime.js:114:1)
    at step (http://localhost:3000/static/js/bundle.js:93038:191)
    at http://localhost:3000/static/js/bundle.js:93038:361
    at <anonymous>

Since async/await is widely supported, and during development, it’s desirable to disable the regenrator runtime.

For anyone interested, you have to update node_modules/babel-preset-react-app/index.js and add

        exclude: [
            'transform-regenerator',
            'transform-async-to-generator',
          ],

at line 113 (babel-preset-env config), then do yarn --force.

This also means I can’t set brakepoints at the lines with await keyword which is pretty annoying.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
z-vrcommented, Feb 19, 2018

I think I can do

"browserslist": {
  "development": [
    "last 1 Chrome version"
  ]
}

actually thanks.

0reactions
justingrantcommented, Feb 12, 2019

@mrapogee - Unfortunately the ability to use browsersList to disable regenerator and other polyfills was removed before V2 of CRA was released. Like you, I also wasted a bunch of time before figuring it out that the advice given by @Timer and @z-vr was accurate when they gave it, but it doesn’t apply anymore to current CRA2 releases.

If you (like me!) want to see this implemented, @ianschmitz suggested to make #6198 the master issue to track this request. Go there add your votes and ideas!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable babel transform-regenerator completely
I'm looking for a way to completely disable generator functions transform with babel. With babel 5 there was a blacklist option, ...
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/plugin-transform-regenerator
Out var _marked = [a].map(regeneratorRuntime.mark); function a() { return regeneratorRuntime.wrap( function a$(_context) { while (1) { switch ...
Read more >
Miscellaneous developer focused changes in WordPress 5.8
Build/Test Tools: Remove IE11 from the list of supported browsers ... The regenerator-runtime script handle has been added to WordPress Core ...
Read more >
babel-loader - webpack
This package allows transpiling JavaScript files using Babel and webpack. ... The following configuration disables automatic per-file runtime injection in ...
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