-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Allow to disable regenerator-runtime #3994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can try the 2.x alphas which let you specify target browsers. If you target the latest chrome version, your async functions will remain as-is. |
@Timer if there any more info on how to do that anywhere please? |
@Timer I know you've closed this, but is it possible to have 2 separate configs for dev and prod? Otherwise it's always required to remove "browserlist" from |
I think I can do "browserslist": {
"development": [
"last 1 Chrome version"
]
} actually |
@z-vr can you explain where that config goes? |
@tyrsius when you start an app with react-scripts 2.0, look in your |
@Timer Ok, I don't think I have that then. I've ejected and Im trying to figure out how to send this option into babel (or preset-env) |
I've been fighting this for hours now, it appears |
@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! |
With the current configuration,
async
is transpiled into generators. If I have an error in an async function, my VS Code withchrome-debugger
extension loadsbundle.js
and jumps to_asyncToGenerator ... catch (error) { reject(error); return; } ...
there which is quite laggy.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 addat line 113 (
babel-preset-env
config), then doyarn --force
.This also means I can't set brakepoints at the lines with
await
keyword which is pretty annoying.The text was updated successfully, but these errors were encountered: