Nextjs:TypeError:不支持的文件类型:更新到 v.11 后未定义 [英] Nextjs: TypeError: unsupported file type: undefined after update to v.11

查看:58
本文介绍了Nextjs:TypeError:不支持的文件类型:更新到 v.11 后未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新后在 11 旁边,当我尝试加载图像时:

After update Next to 11 when I'm trying to load an image with:

import segmentLogoWhitePng from 'assets/images/my-image.png'

我收到以下错误:

TypeError: unsupported file type: undefined (file: undefined)

推荐答案

最新更新

它现在从 next@v11.0.1 开始工作.无需按照以下步骤操作.

Latest Update

It works now as of next@v11.0.1. No need to follow the steps below.

暂时禁用静态图像功能作为解决方法:

Disable the static images feature for now as a workaround:

// next.config.js

module.exports = {
  images: {
    disableStaticImages: true
  }
}


更新:这已在 next@11.0.1-canary.4.安装它:

$ npm install next@canary

请参阅相关问题 &公关.

这篇关于Nextjs:TypeError:不支持的文件类型:更新到 v.11 后未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆