Skip to content

Conversation

@jerrykingxyz
Copy link
Contributor

@jerrykingxyz jerrykingxyz commented Nov 24, 2025

Summary

When recursively resolve BuildDependencies, for performance reasons, resolver will stop when it reaches files within node_modules. This may cause problems when users upgrade dependencies, so package.json needs to be added to buildDependencies.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 24, 2025 09:37
@netlify
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 6ad8a04
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6924275f65e17900082622f4

@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 24, 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 adds tracking of package.json files in node_modules as build dependencies to ensure proper cache invalidation when package metadata changes. This is important for build correctness as changes to package.json files (such as version updates or exports field modifications) can affect module resolution and should trigger cache invalidation.

Key changes:

  • Modified build dependency tracking to include package.json files for resolved modules in node_modules
  • Refactored is_node_package_path utility function from build_dependencies/utils.rs to build_dependencies/helper/utils.rs
  • Extended test coverage to verify cache invalidation behavior for both library and project package.json changes

Reviewed changes

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

Show a summary per file
File Description
crates/rspack_core/src/cache/persistent/build_dependencies/mod.rs Updated import to use is_node_package_path from helper module
crates/rspack_core/src/cache/persistent/build_dependencies/helper/mod.rs Added logic to track package.json files for resolved modules in node_modules; added test case
crates/rspack_core/src/cache/persistent/build_dependencies/helper/utils.rs Refactored utility function location; changed parameter type from &ArcPath to &Path
tests/rspack-test/cacheCases/common/build-dependencies-resolve/rspack.config.js Extended test to cover package.json modification scenarios
tests/rspack-test/cacheCases/common/build-dependencies-resolve/package.json Added project package.json test fixture
tests/rspack-test/cacheCases/common/build-dependencies-resolve/other.config.js Added dependency and comments for clarity
tests/rspack-test/cacheCases/common/build-dependencies-resolve/node_modules/lib/package.json Added version field for testing
tests/rspack-test/cacheCases/common/build-dependencies-resolve/index.js Extended test assertions for new compilation runs
tests/rspack-test/cacheCases/common/build-dependencies-resolve/file.js Added new test data versions

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

@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing 6ad8a04 to feat: support SRI with experiments.css and CssExtractRspackPlugin (#12239) by harpsealjs

❌ Size increased by 7.50KB from 47.63MB to 47.64MB (⬆️0.02%)

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 24, 2025

CodSpeed Performance Report

Merging #12274 will not alter performance

Comparing jerry/fix (6ad8a04) with main (1d0d8cd)

Summary

✅ 17 untouched

@jerrykingxyz jerrykingxyz merged commit 8841af3 into main Nov 25, 2025
82 of 84 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/fix branch November 25, 2025 04:40
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