Fix CSS module digest calculation to use URL paths consistently #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CSS module class names generated by esbuild didn't match Ruby's expectations when using bun. The hash component of class names (e.g.,
base_0877ac8e_...) differed because Go calculated hashes from file system paths while Ruby used URL paths, and bun installs gems in different locations than traditional bundler.Changes
Unified hash calculation on URL paths:
Utils.css_module_digest(abs_path)toUtils.css_module_digest(url_path)whereurl_pathis/node_modules/@rubygems/gem/file.module.cssast.CssLocalHash(args.Path)toast.CssLocalHash(urlPath)whereurlPathfollows same formatAligned path suffix transformation:
CssLocalAppendice:@→_,/→-,.→-node_modules-_rubygems-gem-file-moduleAdded hash replacement for direct imports:
Example
Before:
After:
# Both generate: base_<same-hash>_node_modules-_rubygems-hue-app-components...Known Limitation
Nested CSS module imports (CSS importing other CSS modules) still contain file-path-based hashes in the CSS content itself. This requires updating the esbuild-internal fork to use URL paths throughout its CSS processing pipeline. Direct imports from JavaScript are fully fixed.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.