noUnwantedPolyfillio
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noUnwantedPolyfillio
- This rule doesn’t have a fix.
- The default severity of this rule is warning.
- This rule belongs to the following domains:
- Sources:
- Same as
@next/no-unwanted-polyfillio
- Same as
Description
Section titled “Description”Prevent duplicate polyfills from Polyfill.io.
You are using polyfills from Polyfill.io and including polyfills already shipped with Next.js. This unnecessarily increases page weight which can affect loading performance.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<script src='https://polyfill.io/v3/polyfill.min.js?features=AbortController,Object.fromEntries'></script>
code-block.jsx:1:13 lint/nursery/noUnwantedPolyfillio ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Prevent duplicate polyfills from Polyfill.io
> 1 │ <script src=‘https://polyfill.io/v3/polyfill.min.js?features=AbortController,Object.fromEntries’></script>
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ Object.fromEntries is already shipped with Next.js.
ℹ This unnecessarily increases page weight which can affect loading performance.
import NextScript from 'next/script';
export function MyApp({ Component, pageProps }) { return <NextScript src='https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.copyWithin' />}
code-block.jsx:4:26 lint/nursery/noUnwantedPolyfillio ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Prevent duplicate polyfills from Polyfill.io
3 │ export function MyApp({ Component, pageProps }) {
> 4 │ return <NextScript src=‘https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.copyWithin’ />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 │ }
6 │
ℹ Array.prototype.copyWithin is already shipped with Next.js.
ℹ This unnecessarily increases page weight which can affect loading performance.
<> <script src='https://polyfill.io/v3/polyfill.min.js?features=AbortController'></script> <script src='https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver'></script> <Script src='https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver' /> <Script src='https://polyfill-fastly.io/v3/polyfill.min.js?features=IntersectionObserver' /></>
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noUnwantedPolyfillio": "error" } } }}