-
Notifications
You must be signed in to change notification settings - Fork 213
CSS minification in Neutrino 8 increases build duration by 3-4x #678
Comments
@edmorley I was seeing similar issues with build times (even prior to v8). I switched from Babili, which is what is set by default in Neutrino, to Uglify, and saw a substantial decrease in build times. |
JS minification is also a significant proportion of the build above (with that turned off the build drops from 2m55s to ~20s), albeit not related to the issue here. In another issue it would be good to:
|
@edmorley I have no idea how I missed reference to CSS, which is referenced both in the title and three times in the description 😂 I'll open an additional issue. |
@edmorley That seems crazy…maybe try disabling some specific
|
Using
The size reduction varied between 9KB and 30KB depending on entrypoint: ...so for our case probably still not enough to warrant an almost doubling in warm-cache build times (and possible issues from any CSS minification bugs). A quicker win for us would be to just switch from importing However I realise for smaller projects the build time difference may not be as significant, plus they may not be importing the minified versions of bootstrap/... so have more to benefit. (For what it's worth, I had the Reactstrap docs updated to promote minified bootstrap.) It's worth noting since the OP:
|
For comparison, there is only 11s difference in the warm-cache build when JS minification is enabled/disabled, even though there is a lot more JS to minify. From a quick glance it appears that Hopefully if/when webpack adds native support for CSS minfication in v5/whenever, support for caching/parallism will be added to |
@edmorley I would like to migrate CRA to neutrino, the result must be quite similar. After some attempts with the basic config in a preset on top of
Then I tried just enabling 1 at a time:
What is this big time difference? Somebody has a side by side comparison to CRA? |
@artola, hi! Neutrino 8 uses webpack 3 (same as latest CRA) but babel-minify for JS minification, whereas CRA uses uglify-es. However for Neutrino 9 (the version on I'm hoping we can release an alpha/beta of Neutrino 9 soon. |
Another issue I've found with style minification, is that if I toggle it on/off (using This appears to be due to optimize-css-assets-webpack-plugin not supporting As such, I think we should stop enabling style minification by default, and possibly disconnect it from the web preset entirely (people can always use the preset alongside the web preset). For example - using a react project created using Style minification enabled (currently the default):
Style minification disabled:
(btw both are warm-cache times, in case looking at the durations) |
Agreed. |
Since: * `optimize-css-assets-webpack-plugin` doesn't support `[contenthash]` properly, meaning that filename hashes aren't always updated even when the file content has changed. * `optimize-css-assets-webpack-plugin` doesn't support caching or parallelisation (unlike `uglifyjs-webpack-plugin`), meaning that for large projects, style minification can double the build time. * the file size reduction is often not significant (given that many stylesheets are already available in minified form, eg bootstrap), and so not worth the correctness/performance penalty. * it's easy enough for people to add `@neutrinojs/style-minify` to their project if they still want minification. webpack 5+ will likely be including CSS minification out of the box, and so in the future hopefully these issues should be resolved and so we can re-enable it by default. Fixes #678. Refs #713.
Disabling due to neutrinojs/neutrino#678
After updating to Neutrino 8, I'm seeing 10m30s build times, which are reduced down to 2m55s if I disable CSS minification like so:
Is this kind of increase expected? It was pretty surprising to me, and makes me wonder if CSS minification should actually be changed to be opt-in rather than opt-out?
With CSS minification enabled:
With it disabled:
The text was updated successfully, but these errors were encountered: