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

136
Vistas
Webpack doesn't minify CSS and JS into single line and showing comments

I am running npm run build command and I am expecting it to minify my jss and css files which does but the code is still spread over multiple line and including comments. How to tell webpack to compress it to single line and remove comments?

this is how build command looks into package.json

"build": "npm run buildsprite && webpack --config ./webpack/webpack.config.prod.js --colors",

this is optimization chunk from webpack.config.prod.js

optimization: {
  minimizer: [
    new TerserPlugin({
      test: /\.js(\?.*)?$/i,
      cache: true,
      parallel: true,
      sourceMap: true,
      extractComments: false,
    }),
  ],
},
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As per the Documentation, your webpack.config.prod.js should look something like this:

optimization: {
  minimize: true,
  minimizer: [
    new TerserPlugin({
      test: /\.js(\?.*)?$/i,
      cache: true,
      parallel: true,
      sourceMap: true,
      extractComments: false,
    }),
  ],
},

You Need minimize: true so that webpack can actually Minify using Terser

about 4 years ago · Santiago Trujillo Denunciar
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