Skip to content

fix(core): normalize Windows source map paths - #2102

Merged
yifancong merged 1 commit into
web-infra-dev:mainfrom
dvd233:codex/fix-windows-sourcemap-paths
Oct 16, 2026
Merged

yifancong merged 1 commit into
web-infra-dev:mainfrom
dvd233:codex/fix-windows-sourcemap-paths

Conversation

@dvd233

@dvd233 dvd233 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Motivation

Windows builds with devtool: 'source-map' can emit a source such as C:\project\src/file.js while the module graph uses C:\project\src\file.js. The absolute-path branch kept the mixed separators, so the source did not match its module and its bundled size stayed at zero.

In a real Rspack 2.2.8 reproduction, the default source-map configuration reports 0 bytes before this fix and 3578 bytes after it, with identical emitted JavaScript. An explicitly normalized source-map template reports 3578 bytes both before and after.

Changes

  • Route absolute sources through the existing cached resolver before collecting code and checking skipSources.
  • On Windows, normalize full drive paths and ordinary UNC paths. Preserve POSIX/root-relative paths and device namespaces, and retain the existing URI and relative-source resolution.
  • Add eight unit cases covering path forms, loader/query extraction, caching and cross-asset deduplication, plus a real compilation case that verifies two modules receive their own generated code and matching sizes.

Validation on Windows with Node 22.23.2:

  • Full workspace build passed.
  • pnpm --filter @rsdoctor/core run test: 378 passed, 1 existing Windows skip in the concurrent atomic-write suite.
  • Focused source-map unit tests: 24 passed; six new cases fail on the baseline.
  • rs test run sourcemap in e2e: 4 passed, 0 skipped; the new default-source-map case fails on the baseline with parsedSize = 0.
  • rs check --type-check: lint, type and formatting checks passed.
  • The public-API reproduction now reports 3578 bytes for both default and explicit raw source-map templates; generated JavaScript and map fields other than source names remain identical to the original control builds.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T13:11:42.466510Z 025af66 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@yifancong
yifancong merged commit 451b0bf into web-infra-dev:main Oct 16, 2026
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.

3 participants