plugin-rsc: inject-async-local-storage transform drops source maps

オープン
#1,418 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript

調査の方向性

plugin-rsc パッケージの globalAsyncLocalStoragePlugin から始め、リンクされている再現手順を npm ci と npm run repro で実行します。rsc:inject-async-local-storage 変換を追跡し、適切なテストの場所を特定します。変換後のモジュールがソースマッピングを保持し、マーカーが src/entry.js:6 に解決され、SOURCEMAP_BROKEN 警告がなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

pending triage plugin: rsc
Related plugins
Describe the bug

The rsc:inject-async-local-storage transform changes modules containing both typeof AsyncLocalStorage and new AsyncLocalStorage(), but it does not return a source map for that transformation.

With Vite 8.2.1, the RSC and SSR builds emit SOURCEMAP_BROKEN naming this transform. The final emitted map cannot resolve a marker in the transformed source to any original position: the expected location is src/entry.js:6, while originalPositionFor returns source=null, line=null, column=null.

Expected: the transform preserves and composes source mappings, the marker resolves to src/entry.js:6, and Vite emits no source-map warning for this transform.

Actual: the transformed module loses its original mapping. This can cause incorrect or missing stack-frame symbolication in production error monitoring.

The likely location is globalAsyncLocalStoragePlugin, which prepends initialization text and returns only transformed code. I can submit a patch and test if maintainers confirm the preferred test location.

Reproduction

https://github.com/FieldArchiveTX/vite-plugin-rsc-sourcemap-repro

Steps to reproduce
  1. Clone the reproduction repository.
  2. Run npm ci.
  3. Run npm run repro.
  4. Observe two SOURCEMAP_BROKEN warnings for rsc:inject-async-local-storage and the verifier output showing a null original position.

The reproduction command exits successfully when the defect is reproduced.

System Info
System:
  OS: Windows 11 10.0.26200
  CPU: x64 Intel Core i7-14700KF
Binaries:
  Node: 24.14.0
  npm: 10.9.2
Browsers:
  Chrome: 150.0.7871.187
npmPackages:
  @vitejs/plugin-rsc: 0.5.34
  vite: 8.2.1
  react: 19.2.8
  react-dom: 19.2.8
  react-server-dom-webpack: 19.2.8
Used Package Manager

npm

Logs
[plugin rsc:inject-async-local-storage] [SOURCEMAP_BROKEN]
Sourcemap is likely to be incorrect: a plugin (rsc:inject-async-local-storage) was used to transform files, but didn't generate a sourcemap for the transformation.

expected: src/entry.js:6
traced: source=null, line=null, column=null

REPRODUCED: the emitted source map does not resolve the marker to its source line.
Validations
主要言語
TypeScript
スター
1.2k
フォーク
287
平均マージ
1日 17時間
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vitejs/vite-plugin-react のほかの issue

vitejs/vite-plugin-react の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。