Refactor: Replace optimize-css-assets-webpack-plugin #1436
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Refactor
Did you add tests for your changes?
No new tests, but modified existing ones
Summary
I was talking to the people over at
cssnano
a while back and they were quite opinionated againstoptimize-css-assets-webpack-plugin
, saying things such as "Anywayoptimize-css-assets-webpack-plugin
is bad solution with many bugs, also no caches and parallels" and "I will say again that the plugin is not designed correctly and does not support all webpack features". While I don't know enough to support their claims, I did say I'd bring it up here (even if I did forget about it for a bit).They suggest
css-minimizer-webpack-plugin
in its place, the documentation for which can be found here. They advertise it as "Just likeoptimize-css-assets-webpack-plugin
but more accurate with source maps and assets using query string, allows to cache and works in parallel mode." Now, this plugin is relatively new and has roughly ~4.35 million fewer downloads per week thanoptimize
so there's certainly potential downside to moving to a far lesser used plugin.This PR replaces
optimize-css-assets-webpack-plugin
withcss-minimizer-webpack-plugin
as a draft to get opinions. It seems to be pretty much interchangeable withcss-minimizer-webpack-plugin
, only generating a few more*.css.map
files.Ultimately just a proof of concept of draft I thought I'd float. If it is truly better maybe it's eventually worth looking at.
Does this PR introduce a breaking change?
Yes, this would be a breaking change. Any users who rely on
optimize-css-assets-webpack-plugin
for some specific functionality would have their configurations broken. Some of the options can be found oncss-minimizer
though the configuration will be slightly different in addition to the need to target a new plugin.