-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Revisit @babel/present-env browserslist polyfills #6198
Comments
This looks to be related to #6091 as well |
It looks like this was already implemented in #5264 but never reviewed or merged and went stale. |
Please, please, please could we implement this, or some other way to turn off regenerator runtime in development? Debugging apps that use async/await is incredibly painful with regenerator. |
@justingrant great point! I have horrible issues debugging apps with async/await code or generators. It’d be much better to be able to disable regenerator runtime at least in dev. |
Some things I mentioned in a previous ticket: In any V8 derived environment, native I believe these points also apply to |
@nmain it does also apply to
so I can understand why the maintainers are hesitant to introduce build configuration. I think, however, that |
Currently the workaround we used to adopt CRA was to manually run Babel with the desired targets and debugging turned on along with If we decided to make the polyfill generation respect the browserslist defined in the package.json, I think it would be less confusing. To me, it seems like you must dive into the code at this point to realize the browserslist is only used for CSS even though preset-env supports using it for JS plugins + polyfill too. |
Yea totally. Out of naivety I assumed react-app-polyfill was working like babel-polyfill and using the browserlist to determine what core-js imports were included. create-react-app/packages/babel-preset-react-app/create.js Lines 90 to 92 in 8944aab
I don't understand that assumption. If I'm importing babel-polyfill, I can still be concerned with bundle size. A preset-env that respects user configured browerlist. I can't see the downsides there? |
@duhseekoh my guess is that at the time this was done when |
@esetnik Did you end up submitting a PR for this? It seems like an absolute no-brainer. |
I've created #6608 which adds |
Thank you @ianschmitz. This is going to make many devs very happy. |
Is this a bug report?
No
In the
babel-preset-react-app
project https://github.com/facebook/create-react-app/blob/master/packages/babel-preset-react-app/create.js#L92 it specifically overrides the browserslist configuration and targetsie 9
withuseBuiltIns: false
. I believe this should be revisited as a configuration option to avoid the requirement for most people to ejectcreate-react-app
to run it in production. It seems that the configuration would be much nicer if we could avoid having to include polyfills manually and instead usebrowserslist
configuration with@babel/preset-env
and@babel/polyfill
to do the heavy lifting. Then you'd only need to import@babel/polyfill
in the top of the index.js file (could be included by default with a sensible default browserslist configuration) and you'd automatically get all of the polyfills needed. If this idea is of interest, i'd be happy to submit a PR with the required changes.The text was updated successfully, but these errors were encountered: