Skip to content

Fix Webpack asset manifest generation for production exports#6214

Merged
aduth merged 3 commits intomainfrom
aduth-fix-manifest-images
Apr 18, 2022
Merged

Fix Webpack asset manifest generation for production exports#6214
aduth merged 3 commits intomainfrom
aduth-fix-manifest-images

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Apr 18, 2022

Why: So that the asset manifest plugin correctly identifies all assets.

This improves the plugin introduced in #6198, and addresses a similar peculiarity of Webpack code generation as in #6001. Similar to #6001, the regular expression should match the Webpack output pattern of (0,getAssetPath)('path.svg')). Unlike #6001, we must account for the "comment" fragment which may be output as part of the code generation ((0,assets/* getAssetPath */.K)('id-card.svg'),). The reason this happens here and not in the translation plugin is because the translation export t is already one character, and as such the Webpack mangling logic will not rename it, and the comment fragment is omitted if the export is not renamed. Based on the logic of the mangling plugin, we should expect that the renamed export would be one or more alphabetical characters, or _, or $.

I'm hopeful this will also address the issue I observed at #6212 (comment) (will test to confirm). Edit: Confirmed.

aduth added 3 commits April 18, 2022 09:26
**Why**: So that the asset manifest plugin correctly identifies all assets.
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the tests cases, they made it much easier to follow

@aduth aduth merged commit 07ebc6e into main Apr 18, 2022
@aduth aduth deleted the aduth-fix-manifest-images branch April 18, 2022 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants