Hello Guys, How are you all? Hope You all Are Fine. Today I Have updated my nextjs to 11 and now I can’t use the image it gives me the following error TypeError: unsupported file type: undefined in NextJs. So Here I am Explain to you all the possible solutions here.
Without Wasting your time, Lets start This Article to Solve This Error.
How Nextjs: TypeError: unsupported file type: undefined after update to v.11 Error Occurs ?
Today I Just update Nextjs to v.11 when I’m trying to load an image with:
import segmentLogoWhitePng from 'assets/icons/home.png'
I’m getting the following error:
TypeError: unsupported file type: undefined (file: undefined)
How To Solve Nextjs: TypeError: unsupported file type: undefined after update to v.11 Error ?
Question: How To Solve Nextjs: TypeError: unsupported file type: undefined after update to v.11 Error ?
Answer: To Solve Nextjs: TypeError: unsupported file type: undefined You just need to Disable the static images feature for now as a workaround in next.config.js.
Solution 1
To Solve Nextjs: TypeError: unsupported file type: undefined You just need to Disable the static images feature for now as a workaround in next.config.js.
module.exports = {
images: {
disableStaticImages: true
}
}
Solution 2
You can disable Static Images, and your problem would be solved.
// next.config.js
images: {
disableStaticImages: true
}
Summery
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also Read