premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
313 stars 16 forks source link

Error: "next/font" requires SWC although Babel is being used due to a custom babel config being present. #176

Closed DriveSoft closed 7 months ago

DriveSoft commented 8 months ago

Hi.

After updating (3.3.1) and installing babel-plugin-superjson-next superjson next-superjson-plugin and creating .babelrc file

I'm getting messages:

Syntax error: "next/font" requires SWC although Babel is being used due to a custom babel config being present.

Solution: if you want to use SWC despite the presence of a .babelrc file you can force it in your next.config.js file. https://nextjs.org/docs/messages/swc-disabled

module.exports = {
  experimental: {
    forceSwcTransforms: true,
  },
}
foyarash commented 8 months ago

You can also not use babel and simply use next-superjson-plugin which is a SWC plugin. With this you can remove the babel plugin and the babelrc file, which should make your error disappear.

Thanks for the feedback !

foyarash commented 7 months ago

Closing from inactivity, but feel free to open again if the issue persists