next.js
next.js copied to clipboard
next.config is not work correct with images/unoptimized
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 Binaries: Node: 16.15.1 npm: 8.11.0 Yarn: N/A pnpm: N/A Relevant packages: next: 12.1.0 react: 17.0.2 react-dom: 17.0.2
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
next export
Describe the Bug
In our project we write custom loader without width/height and have console warn about it.
Image with src "/images/***.png" has a "loader" property that does not implement width. Please implement it or use the "unoptimized" property instead.
Read more: https://nextjs.org/docs/messages/next-image-missing-loader-width
In https://nextjs.org/docs/messages/next-image-missing-loader-width this link next recomended use
module.exports = {
experimental: {
images: {
unoptimized: true,
},
},
}
But when i add this rule to config - a have the same warn in console.

Expected Behavior
No warn in console when use unoptimized: true
Link to reproduction
https://codesandbox.io/s/funny-breeze-iwt0yx?file=/next.config.js
To Reproduce
- Implement custom loader without width and height params
- See warn in console
- Go to https://nextjs.org/docs/messages/next-image-missing-loader-width
- Add the unoptimized prop.
- Warn is still in console
It works with v12.3.2
of next.js and my configuration is the below
const nextConfig = {
...
images: {
unoptimized: true
}
}
@Shramkoweb This is not an bug. This functionality was introduced in version 12.2.0
.
You, on the other hand, using version 12.1.0
.
- https://github.com/vercel/next.js/releases/tag/v12.2.0
I think it's worth closing this issue.
@Shramkoweb This is not an bug. This functionality was introduced in version
12.2.0
.You, on the other hand, using version
12.1.0
.
- https://github.com/vercel/next.js/releases/tag/v12.2.0
I think it's worth closing this issue.
From PR So if next export is a hard requirement, the quickest path forward is to disable Image Optimization API. So this PR adds a new configuration option to next.config.js:
But if you read my issue, you can see that after adding this parameter unoptimized: true,
which is described in the documentation and in PR, the error does not disappear.
This doesn't seem to be the case when you move the property out of experimental
!
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.