-
Notifications
You must be signed in to change notification settings - Fork 6
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
Hash not change if change only chunk ids #2
Comments
Also i use webpack v1 with hashedModulesIdsNames extracted from webpack v2, (can't switch to wp2) but i think this issue also reproduced in v2 |
The issue is also happening on webpack2, I can confirm that. I have the exact same issue, and the problem is the id is not being included in the hash calculation, but it's really easy to solve. |
Actually @matpaul , I just saw that the most updated version includes an option to pass a function and include the id by yourself
|
@diestrin brilliant! Real awesome fix 👏 Update: =( I was inspired an idea that this should fix the issue, but after tests - nope =( So chunk id is not change - it's true |
@diestrin @alexindigo const chunkHashRecursion = (chunks, ids) => {
const chunkIds = ids;
chunks.forEach((chunk) => {
chunkIds = chunkIds.concat(chunk.ids);
if (chunks.length) {
chunkHashRecursion(chunk.chunks, chunkIds);
}
});
return chunkIds;
}
const filterAndSort => (array) => {
return array
.filter((item, pos) => array.indexOf(item) === pos)
.sort((a, b) => a - b);
} and setup plugin: new WebpackChunkHash({
additionalHashContent: (chunk) => {
return filterAndSort(chunkHashRecursion(chunk.chunks, chunk.ids));
}
}) It works, but as i see my vendor change hash because extracted manifest change id, |
@matpaul Have a look at here and here. Slightly offtopic: We should compose a plugin that guarantees good caching:
That would be more or less an improved version of the |
Related erm0l0v#7 |
The following solution is wrong:
The following solution is correctish:
You don't want a chunk's hash to change based on its id (consider named chunks). But you want its parent's hash to change. |
setting |
Have you tried using the webpack variable:
|
First of all thanks for your time! As i understand long term caching in webpack is big ass pain(
My prod setup pretty standard
I attach some screens for problem
Build 1
Build 2
And finally changes
This is first file content changes (hash not change)
So any help in this issue will be good
Thank you!
The text was updated successfully, but these errors were encountered: