Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Jaydeep189 opened this issue Aug 28, 2022 · 5 comments
Closed

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

Jaydeep189 opened this issue Aug 28, 2022 · 5 comments

Comments

@Jaydeep189
Copy link

Jaydeep189 commented Aug 28, 2022

error - ./public/logo/amc.png
TypeError: unsupported file type: undefined (file: undefined)

This is my next.config.js

I am using imagemin-optipng for optimization

I am building a static site with nextjs


const nextConfig = withOptimizedImages({
  optimizeImagesInDev: true,
  reactStrictMode: true,
  swcMinify: true,
  experimental: {
    images: {
      unoptimized: true,
    },
  },
});
module.exports = nextConfig;
@signorbusi
Copy link

I'm facing exactly the same problem

@abbasEbadian
Copy link

abbasEbadian commented Sep 9, 2022

I used the withPlugins version of .next.config file and set handleImages: ['*'] then the error gone.

@hannah26hannah
Copy link

I also encounted this error. I'm using withPlugins as well, and for the default config, I set disableStaticImages inside images as true and luckily it resolved this error.

const nextConfig = {
...
  images : {
    disableStaticImages: true,
  }
...
}

@CallumJHays
Copy link

I updated from next@10 to next@12 and ran into this. @abbasEbadian 's fix did silence the error but broke all images.

@hannah26hannah 's fix on the other-hand worked. Cheers!

@Jaydeep189
Copy link
Author

disableStaticImages: true,

It worked!
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants