fix(emotion): should use source code for computing hash #3100
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.
Related issue (if exists)
Fixes #2922
Summary
The PR fixes the hash collision problem of emotion. The
build_info.hash
Rspack give to emotion plugin is empty for every module, so it's easily generate the same hash value for different modules.This PR fixes the problem by passing the hash value computed by the source code of each module to emotion plugin.
馃 Generated by Copilot at ae439ab
This pull request improves the emotion style generation for JavaScript files by using the source code as the basis for class names. It modifies the
parse_and_generate
function and theemotion
visitor invisitors/mod.rs
, and passes the source code as an argument inparser_and_generator/mod.rs
.Walkthrough
馃 Generated by Copilot at ae439ab
parse_and_generate
function to generate unique class names for emotion styles (link, link, link)hash
variable and argument fromparse_and_generate
function andemotion
visitor (link, link)emotion
visitor incrates/rspack_plugin_javascript/src/visitors/mod.rs
to use source code hash instead of build info hash for class names (link)