Skip to content

Hash CSS module class names relative to the repository root - #5985

Merged
Eugene (OEvgeny) merged 3 commits into
mainfrom
OEvgeny/fix-css-module-hash-project-root
Oct 30, 2026
Merged

Eugene (OEvgeny) merged 3 commits into
mainfrom
OEvgeny/fix-css-module-hash-project-root

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Makes hashed CSS Modules class names reproducible, split from the CSS module theme context PR.

Changelog Entry

Changed

  • Hashed CSS class names no longer depend on the build machine's checkout path, in PR #5985, by @OEvgeny

Description

Lightning CSS hashes CSS Modules class names from the absolute file path, so w<hash>_bubble differs between checkouts. It now hashes the path relative to the repository root. Hashed names change once (.wYVITZq_bubble in 4.19 becomes .wbz_wdW_bubble), and readable names such as .bubble stay the same.

Design

  • Repository root instead of each package's root, so modules at the same path in different packages still get different hashes.

Specific Changes

  • esbuildPlugins.mjs: projectRoot for unplugin-lightningcss
  • I have added tests and executed them locally
  • I have added .changelog/<PR#>-<slug>.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Eugene Olonov added 3 commits October 29, 2026 19:34
Without projectRoot, Lightning CSS hashes the absolute file path, so class names differ between machines and checkouts.
Relative to the repository root, they are reproducible and stay distinct for modules at the same path in different packages.
@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 30, 2026 04:55
Copilot AI balanced review requested due to automatic review settings October 30, 2026 04:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@OEvgeny
Eugene (OEvgeny) merged commit 1cee33a into main Oct 30, 2026
45 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-css-module-hash-project-root branch October 30, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants