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

Already on GitHub? Sign in to your account

Exports are not being taken into consideration in the hash generation #2692

Closed
manucorporat opened this issue Feb 14, 2019 · 2 comments · Fixed by #2695
Closed

Exports are not being taken into consideration in the hash generation #2692

manucorporat opened this issue Feb 14, 2019 · 2 comments · Fixed by #2695

Comments

@manucorporat
Copy link
Contributor

manucorporat commented Feb 14, 2019

  • Rollup Version: 1.1.2

How Do We Reproduce?

https://rollupjs.org/repl?version=1.1.2&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGZvbyUyQyUyMGJhciUyMCU3RCUyMGZyb20lMjAnLiUyRmRlcCclM0IlNUNuY29uc29sZS5sb2coZm9vKCklMkMlMjBiYXIoKSklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJvdGhlckVudHJ5LmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMHRoaW5nJTIwJTdEJTIwZnJvbSUyMCcuJTJGZGVwJyUzQiU1Q25jb25zb2xlLmxvZyh0aGluZygpKSUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmRlcC5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJmdW5jdGlvbiUyMGZvbygpJTIwJTdCJTVDbiUyMCUyMHJldHVybiUyMDElM0IlNUNuJTdEJTVDbiU1Q25mdW5jdGlvbiUyMGJhcigpJTIwJTdCJTVDbiUyMCUyMHJldHVybiUyMDIlM0IlNUNuJTdEJTVDbiU1Q25mdW5jdGlvbiUyMHRoaW5nKCklMjAlN0IlNUNuJTIwJTIwcmV0dXJuJTIwYmFyKCklM0IlNUNuJTdEJTVDbiU1Q25leHBvcnQlMjAlN0IlMjBmb28lMkMlMjBiYXIlMkMlMjB0aGluZyUyMCU3RCUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0FmYWxzZSU3RCU1RCUyQyUyMm9wdGlvbnMlMjIlM0ElN0IlMjJmb3JtYXQlMjIlM0ElMjJlc20lMjIlMkMlMjJuYW1lJTIyJTNBJTIybXlCdW5kbGUlMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJleGFtcGxlJTIyJTNBbnVsbCU3RA==

screenshot 2019-02-14 at 13 22 34

screenshot 2019-02-14 at 13 22 46

Expected Behavior

When the exports of a chunk changes, that should always result in a change in the hash.

Actual Behavior

When the main.js module does NOT import bar(), it makes the bar export to be treeshaken in the chunk, but the filename (hash) is the same.

Problematic

This actually breaks some production websites using strong caching, since, it's using a cached module that DOES NOT have some exports.

@manucorporat manucorporat changed the title Exports are not taking into consideration in the hash chunk generation Exports are not being taken into consideration in the hash generation Feb 14, 2019
@snaptopixel
Copy link

@lukastaegert I ran into this (after deploying and breaking production 😢) and @manucorporat helped with the repro (I was using Rollup via StencilJS), it's pretty gnarly when you're caching via CDN.

@lukastaegert
Copy link
Member

Sorry for this and thanks for the awesome repro. Fix at #2695.

lukastaegert added a commit that referenced this issue Feb 17, 2019
* Create hash test type and red test

* Consider actually exported names in hash, resolve #2692

* Add tests for other hashing situations and fix addon hashing

* Rework test to check hashes and contents of all files and throw if two
files with different content share the same hash; fix another issue for
exports that was uncovered by this.

* Remove unnecessary expectations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants