Skip to content

[webpack5-localization-plugin] Streamline processing#5095

Merged
iclanton merged 3 commits intomicrosoft:mainfrom
dmichon-msft:localization-plugin-cache
Feb 5, 2025
Merged

[webpack5-localization-plugin] Streamline processing#5095
iclanton merged 3 commits intomicrosoft:mainfrom
dmichon-msft:localization-plugin-cache

Conversation

@dmichon-msft
Copy link
Contributor

Summary

Fixes #5093

Details

Leverages webpack's caching layer for the localized asset processing.
Currently does not add caching for trueHash computation, that'll need its own PR since it's a bit more complex.
Splits the placeholder map into two layers: a map of keys to files, then string names to placeholders. This facilitates creating fewer intermediary objects and thereby reducing memory pressure and the amount of data processing needed.
Stops parsing non-localized chunks that aren't known to contain placeholders.

How it was tested

Unit tests to ensure functionality didn't regress.
Running against an external project to validate performance impact.

Impacted documentation

API documentation for removed access to internals.

@iclanton iclanton merged commit 29b8d0e into microsoft:main Feb 5, 2025
5 checks passed
@@ -91,6 +143,8 @@ export function processLocalizedAsset(options: IProcessLocalizedAssetOptions): R
const localizedFiles: Record<string, string> = {};
(chunk as ILocalizedWebpackChunk).localizedFiles = localizedFiles;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line needs to happen outside of the caching call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

[webpack5-localization-plugin] Plugin should only recalculate changed assets

2 participants