fix: should add file dependencies in loaderContext.resolve#12107
Merged
LingyuCoder merged 1 commit intomainfrom Nov 6, 2025
Merged
fix: should add file dependencies in loaderContext.resolve#12107LingyuCoder merged 1 commit intomainfrom
loaderContext.resolve#12107LingyuCoder merged 1 commit intomainfrom
Conversation
✅ Deploy Preview for rspack canceled.
|
loaderContext.resolve
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements automatic dependency tracking in the resolver by capturing file and missing dependencies during resolution and exposing them through the resolve API. This eliminates the need for manual dependency tracking in loaders.
- Removes manual
addDependencyandaddMissingDependencycalls in test loader - Adds
ResolveContexttype definition with dependency tracking callbacks in TypeScript - Implements dependency collection in Rust resolver and propagates through the binding layer
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 |
|---|---|
| tests/rspack-test/watchCases/resolve/in-loader/0/loader.js | Removes manual dependency tracking calls and TODO comment, now automated through resolver |
| packages/rspack/src/loader-runner/index.ts | Removes @ts-expect-error annotations and adds type cast to ResolveContext |
| packages/rspack/src/Resolver.ts | Defines ResolveContext type and adds dependency fields to ResolveRequest, implements dependency propagation in resolve callback |
| packages/rspack/etc/core.api.md | Updates API documentation for ResolveContext and ResolveRequest types |
| crates/rspack_core/src/resolver/mod.rs | Exports ResolveContext from resolver module |
| crates/rspack_binding_api/src/resolver.rs | Imports ResolveContext, adds dependency fields to ResolveRequest, collects and returns dependencies from resolver |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
📦 Binary Size-limit
❌ Size increased by 8.50KB from 47.89MB to 47.90MB (⬆️0.02%) |
CodSpeed Performance ReportMerging #12107 will not alter performanceComparing Summary
|
stormslowly
approved these changes
Nov 6, 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
Should add file dependencies and missing dependencies when calling
loaderContext.resolvein loaders. Otherwise the resolved file will not be watched and can not trigger rebuild.Related links
Checklist