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

211
Visualizações
Webpack 5, Images only load broken

I am trying to display images on the screen but the only thing i get is this
broken image

I followed several different guides but they all lead me back to this broken image or no image at all. I have tried svg, jpg and png format but none of them show currectly. I got my images from flaticon and i saved them as pngs and jpgs. They didn't work, i made my own jpg, that didn't work. I then tried svg but they show me this message
Svg Error

Here is the code i have in webpack for module loading

module: {
    rules: [
        {
            test: /\.scss$/,
            use: ['style-loader','css-loader','sass-loader'],
        },
        {
            test: /\.(png|svg|jpg|jpeg|gif)$/i,
            type: 'asset/resource',
        },
    ]
},

here is the code i have for importing the image in js

//import menuburger from './images/test.jpg'
const menuburger = require("./images/menu-burger.svg");
//import add from './images/add.svg'
//import menuleft from './images/angle-left.svg'


const main = async () => {

const mb = document.getElementById('MenuBurgerIMG')

mb.src = menuburger;

html source

<div class = "Menem" id = "MenuBurger">
     <img id  = "MenuBurgerIMG" alt = "" style ="width: 100%;height:100%;">
</div>
about 4 years ago · Juan Pablo Isaza
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