Skip to content

fix(resolve): resolve relative tsconfig paths against cwd - #15713

Draft
intellild wants to merge 2 commits into
mainfrom
codex/fix-relative-tsconfig-path
Draft

intellild wants to merge 2 commits into
mainfrom
codex/fix-relative-tsconfig-path

Conversation

@intellild

@intellild intellild commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

A relative resolve.tsConfig can produce relative module resources through paths. If a resolved module contains import.meta.url, converting that resource to a file URL panics with should be a path: (). Related to #15695.

For example, with cwd /repo, tsConfig: 'config/tsconfig.json', and that config containing baseUrl: './generated' and paths: { '@generated/*': ['./*'] }, importing @generated/client previously produced config/generated/client.js. It should produce /repo/config/generated/client.js.

Changes

Resolve tsconfig file paths against the JavaScript host's cwd before passing options to the binding. WASI's cwd can be / even when Node is running in a project directory, so normalizing on the JS side gives native and WASM builds the same config location.

The Rust resolver also normalizes relative config paths before cache lookup and parsing for direct Rust callers. This gives baseUrl and paths an absolute config directory while preserving already absolute paths and propagating path conversion errors.

Add an import.meta.url regression case covering absolute and relative config paths, string and object tsConfig forms, and configs with and without baseUrl. All eight combinations must produce the same expected file URL.

Validation

  • pnpm run build:cli:dev; rebuilt JavaScript with pnpm run build:js after the host-cwd normalization.
  • pnpm --dir tests/rspack-test run test:base Config.part3.test.js -t 'configCases/resolve/tsconfig': 8 cases passed across the normal and runtime-mode suites, including the new regression matrix.
  • WASM=1 pnpm --dir tests/rspack-test run test:base Config.part3.test.mjs -t 'configCases/resolve/tsconfig': 8 cases passed using the CI merge commit 3d87e6c728 and its matching WASM artifact with the JS fix applied. The same checkout reproduced 2 failing cases before the fix.
  • pnpm exec rs check packages/rspack/src/config/adapter.ts
  • cargo test -p rspack_resolver --lib --locked -- --skip tests::pnp::resolve_pnp_transitive_dep_from_global_cache: 162 passed.
  • cargo clippy -p rspack_resolver --all-targets --all-features --locked -- -D warnings
  • cargo fmt --all --check and formatting check for the new config.

The full resolver unit-test run has one PnP failure, resolve_pnp_transitive_dep_from_global_cache (NotFound("isarray")). The same isolated test fails on the unmodified baseline commit 94eee0f9fe after installing its Yarn fixture, so it was excluded from the passing run above. Local validation was on Linux.


by OpenAI Codex

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing a639ff9 to test: migrate recovery and CSS HMR loaders to ESM (#15709) by Jiahan Chen

❌ Size increased by 4.00KB from 68.78MB to 68.78MB (⬆️0.01%)

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 529.8 KB -114.0 B (-0.0%) -15.0 B (-0.0%)
react-10k 5.4 MB 1.3 MB -59.0 B (-0.0%) -42.0 B (-0.0%)
react-1k 827.7 KB 226.6 KB -59.0 B (-0.0%) -41.0 B (-0.0%)
react-5k 2.6 MB 670.9 KB -59.0 B (-0.0%) -44.0 B (-0.0%)
ui-components 5.0 MB 1.4 MB +46.0 B (0.0%) +28.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

📌 Baseline Commit: 58eb9623573159a7ba7c9504118d2388712db212 | PR: #15709

Metric Current Baseline Change
📊 Total Size 1.7 MB 1.7 MB -114.0 B (-0.0%)
🗜️ Gzip Size 529.8 KB 529.8 KB -15.0 B (-0.0%)
📄 JavaScript 1.7 MB 1.7 MB -114.0 B (-0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 289.0 B 289.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: popular-libs Bundle Diff

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: 58eb9623573159a7ba7c9504118d2388712db212 | PR: #15709

Metric Current Baseline Change
📊 Total Size 5.4 MB 5.4 MB -59.0 B (-0.0%)
🗜️ Gzip Size 1.3 MB 1.3 MB -42.0 B (-0.0%)
📄 JavaScript 5.4 MB 5.4 MB -59.0 B (-0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: 58eb9623573159a7ba7c9504118d2388712db212 | PR: #15709

Metric Current Baseline Change
📊 Total Size 827.7 KB 827.7 KB -59.0 B (-0.0%)
🗜️ Gzip Size 226.6 KB 226.6 KB -41.0 B (-0.0%)
📄 JavaScript 827.3 KB 827.4 KB -59.0 B (-0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-1k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: 58eb9623573159a7ba7c9504118d2388712db212 | PR: #15709

Metric Current Baseline Change
📊 Total Size 2.6 MB 2.6 MB -59.0 B (-0.0%)
🗜️ Gzip Size 670.9 KB 670.9 KB -44.0 B (-0.0%)
📄 JavaScript 2.6 MB 2.6 MB -59.0 B (-0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-5k Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: 58eb9623573159a7ba7c9504118d2388712db212 | PR: #15709

Metric Current Baseline Change
📊 Total Size 5.0 MB 5.0 MB +46.0 B (0.0%)
🗜️ Gzip Size 1.4 MB 1.4 MB +28.0 B (0.0%)
📄 JavaScript 4.9 MB 4.9 MB +46.0 B (0.0%)
🎨 CSS 114.8 KB 114.8 KB 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: ui-components Bundle Diff

🤖 AI Degradation Analysis (Click to expand)

📁 popular-libs

📊 Size Changes

No significant regressions detected 🎉. Total bundle size decreased by 114 bytes (1,777,985 → 1,777,871). Initial JS chunk also decreased (1,777,696 → 1,777,582 bytes).

🔍 Root Cause Analysis

  • vue-router files appear added/removed due to pnpm store hash changes (paths differ, sizes identical), resulting in net zero impact.
  • react-hook-form parsed size decreased by 139 bytes; zod increased by 21 bytes (negligible fluctuations).

⚠️ Risk Assessment

Overall severity: Low

  • Total and initial chunk sizes decreased slightly; no new heavy dependencies or performance risks introduced.

💡 Optimization Suggestions

  1. Verify vue-router isn't being duplicated across chunks due to pnpm hash variations in CI.
  2. No immediate action required; bundle health is stable.

Analysis by qwen3.5-plus

📁 react-10k

📊 Size Changes

No significant regressions detected 🎉

  • Total JS: 5,630,435 → 5,630,376 bytes (-59 bytes)
  • Initial JS: 749,013 → 748,954 bytes (-59 bytes)

🔍 Root Cause Analysis

  • react-router (v7.18.3) parsed size decreased slightly (36,432 → 36,373 bytes), accounting for the total delta.
  • No new modules added; change likely due to build variance or minor tree-shaking improvements.

⚠️ Risk Assessment

Overall severity: Low

  • Initial chunk size decreased slightly, ensuring no negative impact on Time to Interactive (TTI) or load performance.

💡 Optimization Suggestions

  1. No immediate action required; current bundle stability is maintained.
  2. Continue monitoring react-router updates to ensure parsed size remains stable in future releases.
  3. Verify source maps are excluded from production builds if not already configured.

Analysis by qwen3.5-plus

📁 react-1k

📊 Size Changes

No significant regressions detected 🎉. Total bundle size decreased by 59 bytes.

🔍 Root Cause Analysis

  • react-router (v7.18.3): Minor parsed size reduction (36,432 → 36,373 bytes); likely internal patch variance.
  • No new modules or duplicate dependencies introduced.

⚠️ Risk Assessment

Overall severity: Low

  • Total size decreased (847,593 → 847,534 bytes); initial JS chunk stable (781,256 → 781,197 bytes), posing no load-time risk.

💡 Optimization Suggestions

  1. Safe to merge; no performance budget violations detected.
  2. Investigate build config: Module path references dist/development; ensure production builds exclude dev-specific chunks.
  3. Monitor dependencies: Continue tracking react-router updates for larger size shifts.

Analysis by qwen3.5-plus

📁 react-5k

📊 Size Changes

Asset / Chunk Baseline Current Δ Size Δ % Initial?
No significant regressions detected 🎉 2,707,889 B 2,707,830 B -59 B -0.002% -

🔍 Root Cause Analysis

  • react-router (v7.18.3) parsed size decreased slightly (36,432 → 36,373 bytes), accounting for the total delta.
  • No new modules or duplicate dependencies introduced.

⚠️ Risk Assessment

Overall severity: Low

  • Total bundle size decreased (-59 bytes) with stable initial chunk (-59 bytes), posing no performance risk.

💡 Optimization Suggestions

  1. Maintain current tree-shaking configuration; react-router integration is efficient.
  2. Monitor future react-router updates for potential size fluctuations.

Analysis by qwen3.5-plus

📁 ui-components

📊 Size Changes

No significant regressions detected 🎉. Total bundle size increased by only 46 bytes (0.0009%).

🔍 Root Cause Analysis

  • vant locale update: vant/es/locale/lang/zh-CN.mjs parsed size increased by 9.07% (+75 bytes), contributing to the total delta.
  • Dependency noise: @ant-design/cssinjs and @vue/runtime-core show negligible fluctuations (<1% parsed size change).
  • No new modules: No added or removed modules detected in the diff.

⚠️ Risk Assessment

Overall severity: Low

  • The initial JS chunk change (5,114,872 → 5,114,918 bytes) is statistically insignificant and will not affect TTI or FCP.

💡 Optimization Suggestions

  1. No action required; performance impact is negligible.
  2. Verify vant locale configuration to ensure only required languages are bundled.

Analysis by qwen3.5-plus

Generated by Rsdoctor GitHub Action

@codspeed

codspeed Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 50 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing codex/fix-relative-tsconfig-path (a639ff9) with main (58eb962)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant