fix: panic when factorize failed in module executor#10136
Merged
LingyuCoder merged 3 commits intomainfrom Apr 23, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses the panic issue during module factorization by handling diagnostics in the module executor.
- Prevents panic by checking for diagnostics and returning early from the execute task.
- Adds tests in rspack-test-tools to verify that module imports no longer panic.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/rspack.config.js | New test configuration to support the import-module test case |
| packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/render.js | Minimal export to support test execution |
| packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/index.js | Test case ensuring that module import does not panic |
| packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/import-module-example-loader.js | Loader that passes through content |
| packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/example-loader.js | Loader that attempts to import a non-existent module and handles the resulting error |
| crates/rspack_core/src/compiler/module_executor/execute.rs | Updated executor to report diagnostics without panicking |
Files not reviewed (1)
- packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/stats.err: Language not supported
Comments suppressed due to low confidence (1)
crates/rspack_core/src/compiler/module_executor/execute.rs:82
- Ensure that the join method is imported (e.g. from the itertools crate) or use an alternative approach (such as collecting into a Vec and then joining) since join is not part of the standard Iterator trait.
error: Some(diagnostics.iter().map(|d| d.to_string()).join("\n")),
✅ Deploy Preview for rspack canceled.
|
CodSpeed Performance ReportMerging #10136 will not alter performanceComparing Summary
|
quininer
requested changes
Apr 23, 2025
jerrykingxyz
previously approved these changes
Apr 23, 2025
quininer
approved these changes
Apr 23, 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
fix #9931
Checklist