Open loren138 opened 3 years ago
I think I see this in my project as well- a ton of core-js polyfills are included when only 2 or 3 would be used if I manually added in polyfills (for supported browsers).
I resolve it bellow
// do not use react-app-polyfill because it was require('core-js') which cannot remove unused polyfill.
// import 'react-app-polyfill/stable';
import 'core-js/stable';
import 'regenerator-runtime/runtime';
`
Describe the bug
React-App-Polyfill seems to be ignoring the production browserlist from package.json and using some other browserlist instead.
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Read https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md
Environment
Steps to reproduce
npx create-react-app react-polyfill
yarn add react-app-polyfill
src/index.js
addimport 'react-app-polyfill/stable';
as the first lineyarn build
npx source-map-explorer 'build/static/js/*.js'
101 kb of core-js is includedpackage.json
browserlist toyarn build
Expected behavior
Build should have only included
'web.immediate'
matchingActual behavior
Source Analysis:
Reproducible demo
Created with steps above: https://github.com/loren138/react-polyfill-bug