gpt4 book ai didi

reactjs - 有没有办法强制 next.js 让我使用常规图像标签?

转载 作者:行者123 更新时间:2023-12-05 01:28:47 24 4
gpt4 key购买 nike

我有一个带有 <img> 的头像组件标签。它在开发模式下工作正常,但是当我尝试构建项目时,Next.js 抛出以下错误:

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

我不想使用 next/image模块。它doesn't work with blob images .有没有办法强制 next.js 让我使用常规 <img>标签处于生产模式?

最佳答案

在项目的根文件夹中创建 .eslintrc(如果您还没有)

添加下一个代码以关闭该 lint 检查:

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

这应该可以解决您的问题。

了解更多 -> How To Disable ESLint Rules in NextJS

关于reactjs - 有没有办法强制 next.js 让我使用常规图像标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68331679/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com