-
Notifications
You must be signed in to change notification settings - Fork 46
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
Only include hashes for direct child chunks #171
Comments
This would be a welcome feature, thanks! I can't see anything wrong with your plan. There is already some code in place to walk the dependency tree depth first which you could piggyback off of, IIRC ( |
1 task
Awesome, thanks! I'm also traveling and won't be able to take a proper look before next week. |
jscheid
added a commit
that referenced
this issue
Jan 11, 2022
jscheid
added a commit
that referenced
this issue
Jan 12, 2022
jscheid
added a commit
that referenced
this issue
Jan 12, 2022
* Add end-to-end tests for lazy hashes * Validate hashLoading option values Ref #171
This is now released in version 5.1.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'll probably try to take a crack at making a PR to do this myself, but figured I'd solicit some insight first.
Our product has ~1,500 JS assets, and so the SRI hashes alone account for ~80kB of bundle size in the entry chunk. Moreover, we're trying to integrate a large component from a partner team that has a lot of localization assets, doubling that number.
My thought is that, rather than have the SRI hashes for all assets in the entry chunk, each chunk could have the hashes for only its direct child assets (which would be merged in with the root manifest when the chunk is loaded). This is more or less how webpack implements chunk preloading/prefetching. While it does mean that some hashes will be duplicated, it could significantly reduce the size of the manifest in the entry chunk.
To do this, the code would topologically sort the chunk graph, and work backwards from leaf chunks to the entry chunk. The one caveat I can think of is if you have a chunk dependency cycle, since you can't update the manifest in the chunk once the asset has been hashed. In that case, we would need to also detect the cycle, and hoist the hashes to the direct parent(s) of any cycle.
Of course, this can all be done behind an option, so as not to impact small apps that wouldn't need this.
The text was updated successfully, but these errors were encountered: