Fix Webpack locale string extraction for split chunks#5740
Merged
Conversation
**Why**: So that strings for all chunks are generated, even if not directly associated with an entry module.
mitchellhenke
approved these changes
Dec 21, 2021
jmhooper
pushed a commit
that referenced
this pull request
Dec 28, 2021
**Why**: So that strings for all chunks are generated, even if not directly associated with an entry module.
This file contains hidden or 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
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.
Why: So that strings for all chunks are generated, even if not directly associated with an entry module.
Specifically, if Webpack chooses to optimize by splitting a new chunk, the new chunk will have an
entryModuleofundefined, so the previous logic ofisJavaScriptChunkwould returnfalse, and the string would not be translated.This didn't affect us previously because chunk splitting tends to happen only for shared packages, and we don't share much code which involves translation. I noticed this while implementing a refactor in #5729 which would have introduced a new translation call to
@18f/identity-component'sTroubleshootingOptionscomponent, where@18f/identity-componentis a shared package between thedocument-captureandform-steps-waitentry points.I'm hopeful this change should also help make the Webpack 4 to 5 transition a bit simpler, since I'd explored this previously and encountered an issue with
Chunk.entryModulehaving been deprecated. Since we no longer rely on this, the upgrade may be easier.References: