Fully automatic
Needed polyfills are detected in your source code.
Just define your browser targets and start writing features.
core-web is a set of tools to bundle polyfills together with your javascript code. Just define a browsers list and automatically receive everything you need.
npm install --save-dev @mrhenry/babel-plugin-core-web
/* babel.config.js */ module.exports = function(api) { api.cache(true); /* optionally cache the config */ return { plugins: [ // A custom browserslist config : ["@mrhenry/core-web", { browserslist: [ "last 2 versions", ">0.5%" ] }] ] }; };
Needed polyfills are detected in your source code.
Just define your browser targets and start writing features.
Most visitors use a modern browser which doesn't need any polyfills.
Only your bundle(s) for older browsers will include polyfills, allowing you to optimize performance for modern browsers.
Any external client-side dependency has some inherent risk.
Bundling polyfills removes this dependency on a 3rd party provider.
When an external polyfill provider changes or updates code they potentially introduce bugs (or unexpected fixes) impacting your code.
Packaging polyfills with your code adds an extra level of checks to prevent unwanted changes.
Because your build tool sees every polyfill file, you can have sourcemaps.
This makes it easier to debug and report issues.
core-js and @mrhenry/polyfill-library have overlapping polyfills. We make sure you only get a single polyfill for each feature.