-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: CSS Modules [hash] can occasionally be zero length if is entirely numeric #8735
Comments
|
Thanks for the correction @inottn, and seems like a simple enough correction to bring back inline with Webpack so have spun up a PR mentioned above. |
System Info
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 454.94 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - ~/.asdf/installs/nodejs/20.9.0/bin/node
Yarn: 4.4.0 - ~/.asdf/installs/nodejs/20.9.0/bin/yarn
npm: 10.1.0 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 131.0.6778.140
Safari: 17.6
npmPackages:
@rspack/cli: latest => 1.1.6
@rspack/core: latest => 1.1.6
Details
If the hash of a module name/path is entirely numeric the resultant hashed classname has a zero length (due to the removing of numeric characters at the start of the class name), i.e.
for a module with a path/name of:
results in a completely numeric hash of:
(default settings of
xxhash64/hex/16
- although have also had the same withmd4
on a different module)which due to the existing logic to not have a class name starting with a numeric character will continually remove the first character until the hash has a length of zero, resulting in class names such as:
Webpack currently has a solution for checking for this edge case and providing an alternative hash here:
https://github.com/webpack/webpack/blob/964c0315df0ee86a2b4edfdf621afa19db140d4f/lib/css/CssModulesPlugin.js#L437
https://github.com/webpack/webpack/blob/964c0315df0ee86a2b4edfdf621afa19db140d4f/lib/util/nonNumericOnlyHash.js
Which doesn't appear to have an equivalent in Rspack.
Reproduce link
No response
Reproduce Steps
[hash]-[local]
./node_modules/@ppb/the-wall-web/components/walls/Badge/Badge.css
results in a completely numeric hash (with the defaultxxhash64
setting)The text was updated successfully, but these errors were encountered: