fix: should handle loader error with empty stack trace#12213
Merged
Conversation
✅ Deploy Preview for rspack canceled.
|
d7ee052 to
b213c37
Compare
Contributor
📦 Binary Size-limit
❌ Size increased by 896bytes from 47.46MB to 47.46MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #12213 will not alter performanceComparing Summary
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #12080 by properly handling loader errors that have an empty stack trace. When a loader throws an error with stack = "", the system now correctly falls back to displaying the error message instead of attempting to use the empty stack string.
- Added empty stack check in error display logic
- Removed unused
detailsvariable computation in loader scheduler - Added diagnostic test case to verify empty stack trace handling
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_binding_api/src/error.rs |
Added check for empty stack string before using it in Display implementation |
crates/rspack_binding_api/src/plugins/js_loader/scheduler.rs |
Removed unused details variable that was computed but never used |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/index.js |
Test entry point that requires a non-existent module to trigger loader error |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/my-loader.js |
Custom loader that throws an error with empty stack trace |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/rspack.config.js |
Rspack configuration to apply the custom loader |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/stats.err |
Expected error output showing module not found error |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/raw-error.err |
Expected raw error format |
tests/rspack-test/diagnosticsCases/module-build-failed/loader-throw-empty-stack-error/raw-warning.err |
Expected raw warning format (empty array) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ahabhgk
approved these changes
Nov 17, 2025
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.
Summary
Related links
Checklist