NEXTJS_USE_NATIVE_FETCH
Last updated March 4, 2025
Conformance is available on Enterprise plans
Next.js extends the native Web fetch API
with additional caching capabilities which means third-party fetch libraries are not needed.
Including these libraries in your app can increase bundle size and negatively impact performance.
This rule will detect any usage of the following third-party fetch libraries:
- isomorphic-fetch
- whatwg-fetch
- node-fetch
- cross-fetch
- axios
If there are more libraries you would like to restrict, consider using a custom rule.
By default, this rule is disabled. You can enable it by customizing Conformance.
For further reading, see:
- https://nextjs.org/docs/app/api-reference/functions/fetch
- https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
This rule will catch the following code.
import fetch from 'isomorphic-fetch';
 
export async function getAuth() {
  const auth = await fetch('/api/auth');
  return auth.json();
}Replace the third-party fetch library with the native fetch API Next.js provides.
Was this helpful?