-
Notifications
You must be signed in to change notification settings - Fork 603
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iclanton
requested review from
octogonz,
apostolisms,
D4N14L,
dmichon-msft and
TheLarkInn
as code owners
February 5, 2024 00:08
iclanton
force-pushed
the
true-hash-plugin
branch
3 times, most recently
from
February 5, 2024 00:23
c70531c
to
e03363c
Compare
iclanton
force-pushed
the
true-hash-plugin
branch
from
February 5, 2024 00:27
e03363c
to
3769d9f
Compare
dmichon-msft
reviewed
Feb 5, 2024
webpack/webpack5-localization-plugin/src/test/MixedAsync.test.ts
Outdated
Show resolved
Hide resolved
webpack/webpack5-localization-plugin/src/test/NonHashedNonLocalizedAssets.test.ts
Outdated
Show resolved
Hide resolved
webpack/webpack5-localization-plugin/src/test/NonHashedNonLocalizedAssets.test.ts
Outdated
Show resolved
Hide resolved
iclanton
force-pushed
the
true-hash-plugin
branch
from
February 5, 2024 22:10
912fc05
to
4c7dfc8
Compare
iclanton
force-pushed
the
true-hash-plugin
branch
from
February 5, 2024 22:22
4c7dfc8
to
15c0c58
Compare
dmichon-msft
approved these changes
Feb 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 totrue
, 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.