Skip to content

fix: improve contenthash generation #482

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

alexander-akait
Copy link
Member

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

fixes #454

Breaking Changes

No

Additional Info

/cc @sokra

Do we need more logic for contenthash generation as in https://github.com/webpack/webpack/blob/master/lib/javascript/JavascriptModulesPlugin.js

@codecov
Copy link

codecov bot commented Dec 25, 2019

Codecov Report

Merging #482 into master will decrease coverage by 0.12%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #482      +/-   ##
==========================================
- Coverage   88.49%   88.37%   -0.13%     
==========================================
  Files           5        5              
  Lines         426      430       +4     
  Branches       94       96       +2     
==========================================
+ Hits          377      380       +3     
- Misses         47       48       +1     
  Partials        2        2              
Impacted Files Coverage Δ
src/index.js 87.61% <80.00%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa22e44...e1c2a44. Read the comment docs.

hash.update(hashSalt);
}

hash.update(`${chunk.id} `);
Copy link
Member

Choose a reason for hiding this comment

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

These two are not part of the content of the css file

Copy link
Member Author

Choose a reason for hiding this comment

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

@sokra without it, difference async chunks have same contenthash, but difference content, here example #454

Choose a reason for hiding this comment

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

@sokra @evilebottnawi any update on this?

Copy link

Choose a reason for hiding this comment

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

As far as I can tell, CSS modules don't have id property set so the hash is going to be the same. Would it be better to add hash.update(m.index2) (since index2 is used to sort the modules before rendering content asset) below after m.updateHash(hash) ?

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.

contenthash generates same filename for different contents
5 participants