Skip to content
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

fix: correct css modules hashing to match Webpack when leading digit #8735 #8778

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daveskybet
Copy link

@daveskybet daveskybet commented Dec 19, 2024

Summary

As detailed in #8735 Rspack is currently out of sync with a recent change in Webpack around how css module hashes that lead with a digit are handled.

Current Rspack functionality removes all digits from the start of the hash so that hashed classnames never start with a digit, however this produces an edge case where when the hash is entirely digits it is reduced down to an empty string.

Webpack fixed this issue recently to instead prepend hashes starting with a digit with a underscore character ("_") - https://github.com/webpack/webpack/blob/964c0315df0ee86a2b4edfdf621afa19db140d4f/lib/dependencies/CssLocalIdentifierDependency.js#L81

This commit updates the regex/replace functionality to match Webpack's implementation.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@CLAassistant
Copy link

CLAassistant commented Dec 19, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Dec 19, 2024
Copy link

netlify bot commented Dec 19, 2024

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 73d734d
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67641c7bc001090008695379

@daveskybet daveskybet force-pushed the correct_css_module_hashing_8735 branch from 9182c67 to 73d734d Compare December 19, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants