Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.9K
Visualizações
Nextjs: TypeError: unsupported file type: undefined after update to v.11

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

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

I'm getting the following error:

TypeError: unsupported file type: undefined (file: undefined)
over 4 years ago · Santiago Trujillo
5 Respostas
Responde à pergunta

0

In next.config.js you can add file type checks and handlers. I know that svg can be handled by putting the following code and downloading the npm package @svgr/webpack so there could possibly be a .png equivalent

module.exports = {
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/,
      use: ["@svgr/webpack"],
    });

    return config;
  },
};

One example that could work is this code from this stack overflow

module.exports = {
    module: {
      rules: [
        {
          test: /\.(png|jpe?g|gif)$/i,
          use: [
            {
              loader: 'file-loader',
            },
          ],
        },
      ],
    }
};

I know this answer wasn't 100%, but hopefully it helps out a little bit

over 4 years ago · Santiago Trujillo Relatório

0

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
  }
}

Update: This has been fixed in next@11.0.1-canary.4. Install it:

$ npm install next@canary

See the related issue & the PR.

over 4 years ago · Santiago Trujillo Relatório

0

Disable Static Imports

-Since version 10.0.0, Next.js has a built-in Image Component and Automatic Image Optimization

The default behavior allows you to import static files such as import icon from './icon.png and then pass that to the src property. In some cases, you may wish to disable this feature if it conflicts with other plugins that expect the import to behave differently. You can disable static image imports with the following configuration below.

  // next.config.js
  
  images: {
        disableStaticImages: true
    }
over 4 years ago · Santiago Trujillo Relatório

0

look to the issue in the GitHub repo Fix types for the static image it will be work right now

https://github.com/vercel/next.js/pull/25808

  module.exports = {
  images: {
    disableStaticImages: true
  }
}
over 4 years ago · Santiago Trujillo Relatório

0

I just removed my image/css loader config from webpack (next.config.js) and it started working.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda