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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(emotion): should use source code for computing hash #3100

Merged
merged 3 commits into from
May 10, 2023

Conversation

hyf0
Copy link
Collaborator

@hyf0 hyf0 commented May 10, 2023

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 the emotion visitor in visitors/mod.rs, and passes the source code as an argument in parser_and_generator/mod.rs.

Walkthrough

馃 Generated by Copilot at ae439ab

  • Pass source code as a string to parse_and_generate function to generate unique class names for emotion styles (link, link, link)
  • Remove unused hash variable and argument from parse_and_generate function and emotion visitor (link, link)
  • Update emotion visitor in crates/rspack_plugin_javascript/src/visitors/mod.rs to use source code hash instead of build info hash for class names (link)

@hyf0 hyf0 requested review from ahabhgk and h-a-n-a as code owners May 10, 2023 07:30
@hyf0 hyf0 requested a review from underfin May 10, 2023 07:31
@github-actions github-actions bot added release: bug fix team The issue/pr is created by the member of Rspack. labels May 10, 2023
@hyf0 hyf0 enabled auto-merge May 10, 2023 07:50
@hyf0 hyf0 added this pull request to the merge queue May 10, 2023
Merged via the queue into main with commit 7b11360 May 10, 2023
15 checks passed
@hyf0 hyf0 deleted the hyf_02190238490284982039 branch May 10, 2023 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chaos style on FS project
3 participants