Skip to content

fix: panic when factorize failed in module executor#10136

Merged
LingyuCoder merged 3 commits intomainfrom
fix/module-executor-failed
Apr 23, 2025
Merged

fix: panic when factorize failed in module executor#10136
LingyuCoder merged 3 commits intomainfrom
fix/module-executor-failed

Conversation

@LingyuCoder
Copy link
Contributor

Summary

fix #9931

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@LingyuCoder LingyuCoder requested a review from Copilot April 23, 2025 05:32
@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Apr 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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")),

@netlify
Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 71a54b3
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6808a8b25151a80008fd06ec

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 23, 2025

CodSpeed Performance Report

Merging #10136 will not alter performance

Comparing fix/module-executor-failed (71a54b3) with main (90ba7cb)

Summary

✅ 11 untouched benchmarks

jerrykingxyz
jerrykingxyz previously approved these changes Apr 23, 2025
@LingyuCoder LingyuCoder merged commit 430ab91 into main Apr 23, 2025
30 checks passed
@LingyuCoder LingyuCoder deleted the fix/module-executor-failed branch April 23, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: loaderContext.import module with inline loader causes rust panic

4 participants