Polyfills: everything you ever wanted to know, or maybe a bit less
David Gilbertson

“Ironically, you can’t conditionally load a promise polyfill with Webpack 2.”

Actually, you can!

The technique is explained in this article https://philipwalton.com/articles/loading-polyfills-only-when-needed/

And José Quinto wrote a little package based on that article that wraps feature detection code and do polyfill.io call only with non supported features to be polyfilled.


I delete window.Promise; tested it with webpack’s code splitting and it works just fine!