react-code-dataset / next.js /errors /babel-font-loader-conflict.mdx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
---
title: Resolving "Babel and `next/font` Conflict" in Next.js
description: This document explains the "Babel and `next/font` Conflict" in Next.js and provides a solution to resolve this issue.
---
## Why This Error Occurred
The "Babel and `next/font` Conflict" error arises when you attempt to use `next/font` in conjunction with a custom Babel configuration in your Next.js application. When you have a custom Babel config, you opt out of the Next.js Compiler, which is a requirement for using `next/font`.
## Possible Ways to Fix It
To address this issue, you should remove your custom Babel configuration (e.g. `.babelrc`) and instead make use of the Next.js Compiler. This ensures compatibility between your Babel configuration and `next/font`.
## Useful Links
- [Next.js Compiler](/docs/architecture/nextjs-compiler) - Learn more about the Next.js Compiler and how it benefits your application.
- [Customizing Babel Config](/docs/pages/guides/babel) - Understand more about how to customize your Babel configuration in a Next.js application, and the implications of doing so.