parcel-bundler / parcel-bundler/lightningcss

CSS Modules hashes clash within the same file

Open
#351 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: css-modules
Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

I ran into an issue where styles worked in dev but broke in the production build because I set the pattern option to [hash] but it turned out that the hashes were the same for each .module.css file.

You can see this in the current test suite. Notice how the classes are only unique because of the trailing _[local] value. This would break if only the hashes were included: https://github.com/parcel-bundler/lightningcss/blob/27cb9c2a382fd8d9702de8def9dd18db54280c43/tests/cli_integration_tests.rs#L95-L129

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/cli_integration_tests.rs around lines 95-129, where the current CSS Modules behavior and pattern are exercised. Run that test and compare output using [hash] alone; done means classes from each .module.css file remain unique without requiring a trailing [local].

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.