
Show HN: Webpack plugin to prevent loading polyfills when not needed - swimmadude66
https://github.com/swimmadude66/webpack-nomodule-plugin
======
realusername
On my case I use [https://polyfill.io](https://polyfill.io) which is a great
service returning only what the browser needs by user agent. Some example url
I used:
[https://cdn.polyfill.io/v2/polyfill.js?features=Element,requ...](https://cdn.polyfill.io/v2/polyfill.js?features=Element,requestAnimationFrame,Number.parseFloat,es6,Promise,Array.prototype.map,Map,Set).

It avoids adding a lot of useless polyfills for up-to-date browsers.

------
swimmadude66
I was reading an article about the newest features coming to Angular
([https://blog.ninja-squad.com/2019/01/31/angular-
cli-7.3/](https://blog.ninja-squad.com/2019/01/31/angular-cli-7.3/)) and was
intrigued by the `nomodule` attribute. However, I do not use the CLI for my
Angular projects, so I instead made a plugin to do it for me. It uses
`minimatch` to find any files you list as being only needed for older browsers
(or IE) and labels them with the nomodule attribute.

