webpack-contrib/css-minimizer-webpack-plugin

Production only error

karen-sanchez opened this issue · 1 comments

Bug report

The plugin works in development but does not build for production.

Using:

"css-minimizer-webpack-plugin": "^3.1.4"
"webpack": "^5.11.0"
"webpack-cli": "4.6.0"
"webpack-dev-server": "^3.11.2"
"@rails/webpacker": "^6.0.0-beta.5",

Actual Behavior

Webpack was set up like this:

...
  optimization: {
    minimizer: [
      new CssMinimizerPlugin()
    ],
    minimize: true,
  },
...

Running ./bin/webpack --watch --progress results in minified CSS files in development with no errors.

Then I ran the command to bundle for production:
bundle exec rake assets:clean[9]; RAILS_ENV=production bundle exec rake assets:precompile

However, trying to compile for production does not work.

Expected Behavior

The expected behavior is for the plugin to work in both development and production.

How Do We Reproduce?

Please paste the results of npx webpack-cli info here, and mention other relevant information

Error message:

Invalid options object. Css Minimizer Plugin has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'sourceMap'. These properties are valid:
   object { test?, include?, exclude?, minimizerOptions?, parallel?, warningsFilter?, minify? }

In order to get it to work I had to downgrade to "css-minimizer-webpack-plugin": "^1.3.0" but ideally I could use the latest version.

TY!

Please open an issue in webpacker, the sourceMap option was removed and no longer needed