Nextjs:TypeError:不支持的文件类型:更新到v.11后未定义
当我尝试加载图像时更新 Next to 11 之后:
import segmentLogoWhitePng from 'assets/images/my-image.png'
我收到以下错误:
TypeError: unsupported file type: undefined (file: undefined)
回答
最新更新
它现在从next@v11.0.1. 无需遵循以下步骤。
暂时禁用静态图像功能作为解决方法:
// next.config.js
module.exports = {
images: {
disableStaticImages: true
}
}
// next.config.js
module.exports = {
images: {
disableStaticImages: true
}
}
更新:这已在next@11.0.1-canary.4 中得到修复。安装它:
请参阅相关问题和PR。
THE END
二维码