output.polyfill

  • Type: 'entry' | 'usage' | 'off'
  • Default: 'off'

Through the output.polyfill option, you can control the injection mode of the polyfills.

In Rsbuild v0.x, the default value of output.polyfill was 'usage'. Starting from Rsbuild v1.x, the default value is 'off'.

Optional Value

usage

When output.polyfill is configured as 'usage', Rsbuild will inject the polyfills based on the APIs used in each file.

export default {
  output: {
    polyfill: 'usage',
  },
};

entry

When output.polyfill is configured as 'entry', Rsbuild will inject the polyfills in each entry file.

export default {
  output: {
    polyfill: 'entry',
  },
};

off

When output.polyfill is configured as 'off', Rsbuild will not inject the polyfills, and developers need to ensure code compatibility themselves.

export default {
  output: {
    polyfill: 'off',
  },
};

Please refer to the Polyfill Mode for more details.