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

378
Visualizações
Webpack 5 Asset Modules - path in output dist css file is incorrect

i was trying to make a minimalistic webpack 5 config with vue. But i've got stuck at point where i need to copy images from my source to dist and inject them with a correct path to image. I used new webpack feature - Asset Modules. First of all my source dirictory structure:

+--src
   +--assets
      +--fonts
      +--img
      +--js
      +--scss
         +-- main.scss
+--components
+--views

My webpack config

i want to make dist folder nice and clean with separate css js img folders. As for now it generate output just like i want but, the problem is in path that got injected in .css file. My main.scss got background-image: url('../img/test.png'); but in output main.css ive got something like this:

body {
  background-color: lightcoral;
  cursor: pointer;
  background-image: url(img/61c5d4399ef9dc90af90.png);
  background-size: cover;
}

so url(img/61c5d4399ef9dc90af90.png); must be one folder up :url(../img/61c5d4399ef9dc90af90.png);

i want to use this cool webpack feature but now im just stuck

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