# Polyfills loader The polyfills loader makes it easy to manage loading polyfills and/or serving different versions of your application based on browser support. It generates a script that loads the necessary polyfills and the appropriate version of the application through on runtime feature detection. A simplified version of the loader: ```js // detect support for various browser features, load a polyfill if necessary var polyfills = []; if (!('fetch' in window)) { polyfills.push(loadScript('./polyfills/fetch.js')); } if (!('IntersectionObserver' in window)) { polyfills.push(loadScript('./polyfills/intersection-observer.js')); } // wait for polyfills to load Promise.all(polyfills).then(function () { if (!('noModule' in HTMLScriptElement.prototype)) { // browser doesn't support es modules, load a SystemJS build with es5 System.import('./legacy/app.js'); } else { // browser supports modules, import a modern build import('./app.js'); } }); ``` ## Performance The primary reason for this project is to make it easier to build performant web apps. The web ecosystem is evolving fast, it's easy to end up with many unnecessary polyfills in your application because all supported browsers already implement the feature you are using. By loading polyfills conditionally, you make sure you only load what's necessary and you don't need to include them in your main bundle. Polyfills are hashed based on content, so they can be cached indefinitely by a web server or service worker. Serving different versions of your application means you don't need to serve the lowest common denominator to all of your users. This is often achieved used `