Allow to disable regenerator-runtime
See original GitHub issueWith 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:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top 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 >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 I can do
actually thanks.
@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!