-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix(context-replacement): only apply changes when regex matches #12657
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
fix(context-replacement): only apply changes when regex matches #12657
Conversation
✅ Deploy Preview for rspack canceled.Built without sensitive environment variables
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
Thank you! ❤️ |
The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes web-infra-dev#12656
Head branch was pushed to by a user without write access
0300b88 to
2c9cfd8
Compare
|
@chenjiahan @SyMind rebased with main branch since some unexpected test failures |
fix(ContextReplacementPlugin): only apply changes when regex matches The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes #12656
fix(ContextReplacementPlugin): only apply changes when regex matches The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes #12656
fix(ContextReplacementPlugin): only apply changes when regex matches The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes #12656
fix(ContextReplacementPlugin): only apply changes when regex matches The plugin was applying transformations (recursive, regExp, critical) to all require.context() calls regardless of whether the configured regex pattern matched the request. This fix ensures all transformations only apply when the regex successfully matches. Closes #12656
Summary
ContextReplacementPluginapplied transformations to allrequire.context()calls regardless of regex matchnew_content_resourceconditional, causingrecursive,regExp, andcriticalmodifications to apply to non-matching contextsTest plan
context-replacement/non-matching-regexthat verifies non-matching contexts are not affectedCloses #12656