TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Webpack plugin to prevent loading polyfills when not needed

6 pointsby swimmadude66about 6 years ago

2 comments

realusernameabout 6 years ago
On my case I use <a href="https:&#x2F;&#x2F;polyfill.io" rel="nofollow">https:&#x2F;&#x2F;polyfill.io</a> which is a great service returning only what the browser needs by user agent. Some example url I used: <a href="https:&#x2F;&#x2F;cdn.polyfill.io&#x2F;v2&#x2F;polyfill.js?features=Element,requestAnimationFrame,Number.parseFloat,es6,Promise,Array.prototype.map,Map,Set" rel="nofollow">https:&#x2F;&#x2F;cdn.polyfill.io&#x2F;v2&#x2F;polyfill.js?features=Element,requ...</a>.<p>It avoids adding a lot of useless polyfills for up-to-date browsers.
swimmadude66about 6 years ago
I was reading an article about the newest features coming to Angular (<a href="https:&#x2F;&#x2F;blog.ninja-squad.com&#x2F;2019&#x2F;01&#x2F;31&#x2F;angular-cli-7.3&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.ninja-squad.com&#x2F;2019&#x2F;01&#x2F;31&#x2F;angular-cli-7.3&#x2F;</a>) 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.