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

[webpack5-localization-plugin] Include a feature for generating true filename hashes. #4510

Merged
merged 24 commits into from
Feb 5, 2024

Conversation

iclanton
Copy link
Member

@iclanton iclanton commented Feb 5, 2024

Summary

The localization plugin currently has an issue where filename hashes are 1) the same on a chunk between all locales and 2) not updated if strings are changed. This PR introduces an option to the localization plugin called useTrueHashes that, when set to true, updates hashes to match individual filenames' contents.

Details

Updating hashes is achieved by postprocessing chunks after all localized variants are rendered. Chunks are processed in reverse-tree-order, updating the hashes of async chunks in the runtime chunk loading code in the runtime chunk's bodies after async chunks are renamed, and then hashing runtime chunks to reflect the updated async chunk filename hashes.

How it was tested

Unit tests in the localization plugin project have been updated to exercise this new functionality. This has also been tested in a large monorepo that uses the localization plugin.

Impacted documentation

This option should be documented.

@iclanton iclanton force-pushed the true-hash-plugin branch 3 times, most recently from c70531c to e03363c Compare February 5, 2024 00:23
@iclanton iclanton enabled auto-merge February 5, 2024 23:30
@iclanton iclanton merged commit 14ccbe5 into microsoft:main Feb 5, 2024
5 checks passed
@iclanton iclanton deleted the true-hash-plugin branch February 5, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants