Skip to content

refactor: remove support for nested importModule usage#12111

Merged
jerrykingxyz merged 1 commit intomainfrom
jerry/module_executor
Nov 7, 2025
Merged

refactor: remove support for nested importModule usage#12111
jerrykingxyz merged 1 commit intomainfrom
jerry/module_executor

Conversation

@jerrykingxyz
Copy link
Copy Markdown
Contributor

@jerrykingxyz jerrykingxyz commented Nov 7, 2025

Summary

Nested use of importModule can easily lead to unexpected situations, such as circular calls. In most cases, nested use is also not the behavior expected by users. This PR will throw an error directly when nested calls are made.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 7, 2025 06:11
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 7, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit edd00f4
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/690db72be78fa40008875e69

@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 Nov 7, 2025
Copy link
Copy Markdown
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 refactors the module execution flow in the compilation process by introducing a deferred startup mechanism and extracting module graph repair logic.

  • Changed hook_before_make to return a closure that spawns the task loop, allowing better control over when execution starts
  • Extracted calc_repair_tasks from the repair function to enable reuse of task calculation logic
  • Added from_module_graph method to ModuleTracker to reconstruct tracker state from existing module graph

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rspack_core/src/compiler/compilation.rs Modified to call the returned closure from hook_before_make after restoring module_executor
crates/rspack_core/src/compilation/make/module_executor/module_tracker.rs Added from_module_graph method to create tracker from existing module graph state; simplified entry module handling
crates/rspack_core/src/compilation/make/module_executor/mod.rs Refactored hook_before_make to return a closure that starts the task loop; integrated cutout and repair logic
crates/rspack_core/src/compilation/make/graph_updater/repair/mod.rs Extracted calc_repair_tasks function from repair to enable task calculation reuse
crates/rspack_core/src/compilation/make/graph_updater/mod.rs Made cutout module public
crates/rspack_core/src/compilation/make/graph_updater/cutout/mod.rs Added add_need_check_issuer_module helper method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 7, 2025

📦 Binary Size-limit

Comparing edd00f4 to fix: should add file dependencies in loaderContext.resolve (#12107) by harpsealjs

❌ Size increased by 256bytes from 47.89MB to 47.90MB (⬆️0.00%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 7, 2025

CodSpeed Performance Report

Merging #12111 will not alter performance

Comparing jerry/module_executor (edd00f4) with main (6737fba)

Summary

✅ 17 untouched

@jerrykingxyz jerrykingxyz force-pushed the jerry/module_executor branch from 955dc9d to 6772032 Compare November 7, 2025 08:56
@jerrykingxyz jerrykingxyz changed the title fix: rebuild panic when using nested importModule refactor: remove support for nested importModule usage Nov 7, 2025
@github-actions github-actions bot added release: refactor and removed release: bug fix release: bug related release(mr only) labels Nov 7, 2025
@jerrykingxyz jerrykingxyz force-pushed the jerry/module_executor branch from 6772032 to edd00f4 Compare November 7, 2025 09:08
@jerrykingxyz jerrykingxyz merged commit a2ba295 into main Nov 7, 2025
46 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/module_executor branch November 7, 2025 09:30
jerrykingxyz added a commit that referenced this pull request Nov 12, 2025
hardfist pushed a commit that referenced this pull request Nov 12, 2025
… (#12165)

Revert "refactor: remove support for nested importModule usage (#12111)"

This reverts commit a2ba295.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants