webpack/css-loader

Default localIdentHashDigestLength to 12

Closed this issue · 6 comments

Modification Proposal

I suggest changing localIdentHashDigestLength from 20 to 12. This is a 40% reduction in the size of class names (which are high entropy/non-compressible).

100k items in 2^(12*3/4*8) buckets have < 2e-12 probability of collision. (though class name sanitization is not a true base64 encoding).

https://kevingal.com/apps/collision.html

Expected Behavior / Situation

localIdentHashDigestLength defaults to 12

Actual Behavior / Situation

localIdentHashDigestLength defaults to 20

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

Make sense but only for the next major release

hm, let's rise this issue in webpack repo, because we are getting this value from https://webpack.js.org/configuration/output/#outputhashdigestlength, there was once a big conversation about the value, but I can’t find it, so if you want we can start it again

Anyway in future built-in CSS support in webpack we use another approach and will be very small value, not sure we can change it here easy

and will be very small value

Okay, thanks.

(Personally, I've override the naming to be <file_integer>_<class_integer>.)

there was once a big conversation about the value

Surprised 20 was the result....as mentioned, with 40% less, theres 1 in one trillion chance of collision with 100,000 classes in the bundle.

Yeah, I actually think you're right, but I'm afraid changing this value right now (i.e. without major release of webpack) might cause certain side effects problems...