Lukasz Wiktor
Lukasz Wiktor

Reputation: 20422

Is there a way to force next.js to let me use a regular image tag?

I have an Avatar component with an <img> tag. It's working fine in development mode, but when I try to build the project then Next.js throws the following error:

Failed to compile.

./components/Avatar.js
59:9  Error: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.  @next/next/no-img-element

I don't want to use the next/image module. It doesn't work with blob images. Is there a way to force next.js to let me use the regular <img> tag in production mode?

Upvotes: 3

Views: 1725

Answers (1)

Luka
Luka

Reputation: 1008

Create .eslintrc (if you don't have it already) in project's root folder

Add the next code to turn off that lint check:

{
  "rules": {
    "@next/next/no-img-element": "off"
  }
}

This should solve your issue.

Learn more -> How To Disable ESLint Rules in NextJS

Upvotes: 7

Related Questions