umi-plugin-autopolyfill

umi plugin for polyfill.io

Usage no npm install needed!

<script type="module">
  import umiPluginAutopolyfill from 'https://cdn.skypack.dev/umi-plugin-autopolyfill';
</script>

README

umi-plugin-autopolyfill

NPM version NPM downloads

Get only the polyfills that are needed by the requesting browser.

Umi plugin for polyfill.io

Install

npm i umi-plugin-autopolyfill --save-dev

Usage

Configure in .umirc.js,

export default {
  plugins: [
    ['umi-plugin-autopolyfill', {
      features: ['es5', 'es6', 'Array.from'],
      flags: 'gated'
    }],
  ],
}

Options

  • features: Array Polyfill you want to request. See all available polyfills
  • flags: gated | always Configuration settings for every polyfill being requested. Possible values are always and gated. Setting always will return all requested polyfills to every browser. Setting gated will wrap every polyfill within a feature detection, only adding the polyfill if the feature was not detected. To enable both settings, separate them with a comma E.G. always,gated.
  • endpoint: string The polyfill server endpoint. Default to //polyfill.io/v3/polyfill.min.js

LICENSE

MIT