Skip to content

Fix non-updating asset hashes#1861

Merged
devongovett merged 5 commits into
masterfrom
fix/asset-hashe
Aug 24, 2018
Merged

Fix non-updating asset hashes#1861
devongovett merged 5 commits into
masterfrom
fix/asset-hashe

Conversation

@DeMoorJasper

@DeMoorJasper DeMoorJasper commented Aug 7, 2018

Copy link
Copy Markdown
Member

Include asset content in asset hash, as generated not always outputs the entire ast and makes it unreliable. (Only content would probably also be unreliable)

Should prevent some cases where assets don't get updated either from cache or HMR

Closes #1789

@DeMoorJasper DeMoorJasper changed the title add content hash to asset hash Fix non-updating asset hashes Aug 7, 2018
Comment thread src/Asset.js Outdated
let contentHash = '';
try {
contentHash = md5(this.contents);
} catch (err) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In case this.contents is not a string or undefined

@devongovett

devongovett commented Aug 22, 2018

Copy link
Copy Markdown
Member

Maybe the hash should be based on the contents after post processing instead of generate also? That seems to be related to this issue.

@DeMoorJasper

DeMoorJasper commented Aug 22, 2018

Copy link
Copy Markdown
Member Author

So moving hash generation to the Pipeline after postProcess?

Or just merging the asset hash with postProcessed output hash?

@devongovett

Copy link
Copy Markdown
Member

Yeah I guess? I'd say just hash the original content but sometimes we don't actually read it (so you have the try..catch). Try just hashing the post-processed output instead of generate and see if that fixes the bug.

@DeMoorJasper

Copy link
Copy Markdown
Member Author

Changed it, should still fix the issue. As it's pretty much doing the same. Just on output instead of input. (which is probably more reliable for virtual assets like globs)

Comment thread src/Asset.js
@@ -214,7 +213,7 @@ class Asset {
}

generateHash() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this method needed anymore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

RawAsset uses it as it has no generated content

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should keep the method then and just call it after post-processing is done?

@devongovett

Copy link
Copy Markdown
Member

Looks like the tests are failing because the yarn lockfile is pointing at adobe corp artifactory. Can you fix?

@DeMoorJasper

Copy link
Copy Markdown
Member Author

@devongovett I think it ended up in the master branch by accident, can't seem to find it in this branch.

Appears to be the flow deps, I'll open a seperate PR to fix that

@devongovett devongovett merged commit 8a743f3 into master Aug 24, 2018
@devongovett devongovett deleted the fix/asset-hashe branch August 24, 2018 19:20
devongovett pushed a commit that referenced this pull request Oct 15, 2018
devongovett pushed a commit that referenced this pull request Oct 15, 2018
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.

3 participants