Skip to content

fix: should add file dependencies in loaderContext.resolve#12107

Merged
LingyuCoder merged 1 commit intomainfrom
fix/loader-resolve-dependencies
Nov 6, 2025
Merged

fix: should add file dependencies in loaderContext.resolve#12107
LingyuCoder merged 1 commit intomainfrom
fix/loader-resolve-dependencies

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

Summary

Should add file dependencies and missing dependencies when calling loaderContext.resolve in loaders. Otherwise the resolved file will not be watched and can not trigger rebuild.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 6, 2025 09:19
@LingyuCoder LingyuCoder requested a review from hardfist as a code owner November 6, 2025 09:19
@netlify
Copy link
Copy Markdown

netlify bot commented Nov 6, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 0a41dac
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/690c6834dd99750008c4d2f1

@LingyuCoder LingyuCoder changed the title fix: should add file dependencies in loaderContext.resolve fix: should add file dependencies in loaderContext.resolve Nov 6, 2025
@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Nov 6, 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 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 addDependency and addMissingDependency calls in test loader
  • Adds ResolveContext type 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 6, 2025

📦 Binary Size-limit

Comparing 0a41dac to test: enable more watch cases (#12106) by harpsealjs

❌ Size increased by 8.50KB from 47.89MB to 47.90MB (⬆️0.02%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 6, 2025

CodSpeed Performance Report

Merging #12107 will not alter performance

Comparing fix/loader-resolve-dependencies (0a41dac) with main (daca78b)

Summary

✅ 17 untouched

@LingyuCoder LingyuCoder enabled auto-merge (squash) November 6, 2025 10:10
@LingyuCoder LingyuCoder merged commit 6737fba into main Nov 6, 2025
102 of 107 checks passed
@LingyuCoder LingyuCoder deleted the fix/loader-resolve-dependencies branch November 6, 2025 13:18
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.

3 participants