'entry' | 'usage' | 'off''off'Controls the polyfill injection mode.
See Polyfill Mode for more details.
With output.polyfill set to 'usage', Rsbuild injects polyfills based on the APIs used in each file. This provides optimal bundle size by including only needed polyfills.
With output.polyfill set to 'entry', Rsbuild injects polyfills in each entry file. This ensures all polyfills are available but may increase bundle size.
It should be noted that when you bundle page with Web Workers, the entry mode is not applicable to Web Workers because the Web Workers thread is isolated from the main thread (page), and the usage mode can be used at this time.
With output.polyfill set to 'off', Rsbuild doesn't inject polyfills. You need to handle code compatibility yourself.