Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

382
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda