-
-
Notifications
You must be signed in to change notification settings - Fork 746
revert: refactor: remove support for nested importModule usage (#12111) #12165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit a2ba295.
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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 reverts commit a2ba295 which had removed support for nested importModule usage in loaders. The revert re-enables nested importModule calls by changing the error handling from "not supported" to proper circular dependency detection.
Key changes:
- Re-enables nested
importModuleusage in loaders by removing the early rejection - Updates error messages to report "circular build dependency" instead of "nested calls not supported"
- Adds new test cases for cache behavior with loader import modules
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_core/src/compilation/make/module_executor/module_tracker.rs | Removes is_module_building check and renames is_entry_running to is_running |
| crates/rspack_core/src/compilation/make/module_executor/entry.rs | Removes nested importModule check and updates function call to is_running |
| tests/rspack-test/normalCases/errors/import-module-cycle/index.js | Updates error expectations from "nested calls not supported" to "circular build dependency" |
| tests/rspack-test/normalCases/errors/import-module-cycle-multiple/index.js | Updates expected error outputs to show deeper cycle detection |
| tests/rspack-test/configCases/loader-import-module/recursive-import-module/errors.js | Removes error expectations for nested importModule (now allowed) |
| tests/rspack-test/configCases/loader-parallel-import-module/recursive-import-module/errors.js | Removes error expectations for nested importModule (now allowed) |
| tests/rspack-test/watchCases/cache/loader-import-module/* | Adds new test suite for cache behavior with loader import modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,2 @@ | |||
|
|
|||
| module.exports = () => "FIXME: panic" | |||
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test filter contains a 'FIXME: panic' message, indicating the test is currently disabled or broken. This should be addressed before merging the revert to ensure the test properly validates the restored nested importModule functionality.
| module.exports = () => "FIXME: panic" | |
| module.exports = () => true |
| import a from "./a.generate-json.js"; | ||
| import { value as unrelated } from "./unrelated"; | ||
|
|
||
| it("should have to correct values and validate on change", () => { |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| it("should have to correct values and validate on change", () => { | |
| it("should have to correct values and validate on change", () => { | |
| expect(a).not.toBeUndefined(); |
| import a from "./a.generate-json.js"; | ||
| import { value as unrelated } from "./unrelated"; | ||
|
|
||
| it("should have to correct values and validate on change", () => { |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| it("should have to correct values and validate on change", () => { | |
| it("should have to correct values and validate on change", () => { | |
| if (typeof a === "undefined") { | |
| throw new Error('Imported "a" from "./a.generate-json.js" is undefined. Please ensure the module exports the expected object.'); | |
| } |
| expect(a.nested.value).toBe(step < 3 ? 42 : 24); | ||
| expect(a.nested.a).toBe(step < 3 ? "a" : undefined); | ||
| expect(a.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.c).toBe(step < 1 ? undefined : "c"); | ||
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| expect(a.nested.value).toBe(step < 3 ? 42 : 24); | |
| expect(a.nested.a).toBe(step < 3 ? "a" : undefined); | |
| expect(a.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.c).toBe(step < 1 ? undefined : "c"); | |
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); | |
| expect(a.nested?.value).toBe(step < 3 ? 42 : 24); | |
| expect(a.nested?.a).toBe(step < 3 ? "a" : undefined); | |
| expect(a.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.nested?.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.c).toBe(step < 1 ? undefined : "c"); | |
| expect(a.nested?.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
| expect(a.nested.value).toBe(step < 3 ? 42 : 24); | ||
| expect(a.nested.a).toBe(step < 3 ? "a" : undefined); | ||
| expect(a.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.c).toBe(step < 1 ? undefined : "c"); | ||
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| expect(a.nested.value).toBe(step < 3 ? 42 : 24); | |
| expect(a.nested.a).toBe(step < 3 ? "a" : undefined); | |
| expect(a.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.c).toBe(step < 1 ? undefined : "c"); | |
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); | |
| expect(a.nested?.value).toBe(step < 3 ? 42 : 24); | |
| expect(a.nested?.a).toBe(step < 3 ? "a" : undefined); | |
| expect(a.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.nested?.b).toBe(step < 1 ? "b" : undefined); | |
| expect(a.c).toBe(step < 1 ? undefined : "c"); | |
| expect(a.nested?.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
| expect(a.nested.a).toBe(step < 3 ? "a" : undefined); | ||
| expect(a.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.c).toBe(step < 1 ? undefined : "c"); |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| expect(a.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.nested.b).toBe(step < 1 ? "b" : undefined); | ||
| expect(a.c).toBe(step < 1 ? undefined : "c"); | ||
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); | |
| expect(a.nested?.c).toBe(step < 1 || step >= 3 ? undefined : "c"); |
| expect(a.c).toBe(step < 1 ? undefined : "c"); | ||
| expect(a.nested.c).toBe(step < 1 || step >= 3 ? undefined : "c"); | ||
| if (step !== 0) { | ||
| expect(STATE.random === a.random).toBe(step === 2); |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| if (step !== 0) { | ||
| expect(STATE.random === a.random).toBe(step === 2); | ||
| } | ||
| STATE.random = a.random; |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base expression of this property access is always undefined.
| import { value as unrelated } from "./unrelated"; | ||
|
|
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import unrelated.
| import { value as unrelated } from "./unrelated"; |
📦 Binary Size-limit
🙈 Size remains the same at 48.09MB |
CodSpeed Performance ReportMerging #12165 will not alter performanceComparing Summary
|
This reverts commit a2ba295.
Summary
Fix the ecosystem CI: https://github.com/web-infra-dev/rspack/actions/runs/19288926831/job/55155671354
Related links
Checklist