Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!