简体   繁体   中英

How do I know which ES6 functions I need to polyfill?

After much hair-pulling with create-react-app, I now understand Babel only polyfills a few ES6 functions and leaves the rest to crash on anything that isn't super-new Chrome.

Now, given that I need to manually add the pertaining polyfills myself, is there a way of just adding all ES6 polyfills in, or do I need to go through every component and node module manually to find every breaking function?

The best strategy personally I found is to compile project for production, deploy it and test everything in a browsers you want your website to support, either by installing them or using virtual machines, or even tools like https://www.browserling.com/ or https://crossbrowsertesting.com/

You could easily inspect your browser console then and google for errors (they're easy to search and find out which polyfill you actually needs)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM