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

139
Visualizações
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 Respostas
Responde à pergunta

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