'sourceMap' causing error in other plugin(s)
karen-sanchez opened this issue · 1 comments
Hello,
I recently opened a new issue with the css minimizer webpack plugin but I was told that this is caused by webpacker and that I should open an issue here instead.
Here is the reply I received from cc-minimizer:
Please open an issue in webpacker, the sourceMap option was removed and no longer needed
I'll paste my problem below:
Bug report
The plugin css-minimizer-webpack-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 Webpacker to work with the plugin 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!
@guillaumebriday I recommend that we close this as this will be addressed in v6.
It was fixed here: