feat: DefinePlugin error reporting and evaluation safety#20260
feat: DefinePlugin error reporting and evaluation safety#20260AarishMansur wants to merge 5 commits intowebpack:mainfrom
Conversation
|
alexander-akait
left a comment
There was a problem hiding this comment.
Please add test cases in test/statsCases, thanks
|
@alexander-akait done lemme know if further changes are needed as well |
|
@AarishMansur please fix rebase, thanks |
d5aa9e2 to
27b7ae2
Compare
@alexander-akait fixed rebased |
CodSpeed Performance ReportMerging #20260 will not alter performanceComparing Summary
|
|
Hey @alexander-akait just checking if my PR needs further changes or not ? |
What is the expected behavior?
Errors that occur while evaluating values inside DefinePlugin should be reported clearly during compilation, with enough context to identify the failing definition.
What is the motivation or use case for adding/changing the behavior?
When DefinePlugin is misconfigured (for example, passing a raw string instead of a stringified value), the resulting errors are often vague or only appear at runtime. This makes debugging difficult and hurts DX.
How should this be implemented in your opinion?
Catch evaluation errors inside DefinePlugin and surface them as informative WebpackErrors, while ensuring internal recursion flags are always reset.
What does this PR do?
Benefits
Screenshot
Are you willing to work on this yourself?
Yes.