September 12, 2020 by Andreas Wik
One thing I’ve used it for myself has been when an external library may be using an ES6 feature that’s not necessarily supported in older browsers.
polyfill.io checks what browser makes the request, and depending on that it returns the necessary polyfills.
I can then simply include the following on my page, before the library:
polyfill.io will now return any polyfills that the browser may need.
You can also decide to only request polyfills for certain features that you know are used in your code. Let’s say we specifically need a polyfill for Object.assign if the browser doesn’t support it. We would then add on a features parameter (which should be a comma separated list if more than one):
Check out polyfill.io for more details.