plugin-rsc: inject-async-local-storage transform drops source maps
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- build-system, tooling
Research direction
Start at the globalAsyncLocalStoragePlugin in the plugin-rsc package and run the linked reproduction with npm ci and npm run repro. Trace the rsc:inject-async-local-storage transform and identify the appropriate test location. Done means the transformed module preserves source mappings, the marker resolves to src/entry.js:6, and the SOURCEMAP_BROKEN warning is gone.
Written by the indexing model from the issue text.
Description
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
- Clone the reproduction repository.
- Run
npm ci. - Run
npm run repro. - Observe two
SOURCEMAP_BROKENwarnings forrsc:inject-async-local-storageand 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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 287
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 19
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vitejs/vite-plugin-react
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)Possibly taken @wozhenbang2004 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
vitejs/vite-plugin-react#1570 ·
Maintainers usually reply within 1 day
-
pending triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
vitejs/vite-plugin-react#1581 ·
Maintainers usually reply within 1 day
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC buildPossibly taken @NeilPant claimed this 4 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
vitejs/vite-plugin-react#1578 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
vitejs/vite-plugin-react#1577 ·
Maintainers usually reply within 1 day
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceErrorPossibly taken @draarivpatel-ui claimed this 2 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
vitejs/vite-plugin-react#1566 · 1 comment ·
Maintainers usually reply within 1 day
All issues in vitejs/vite-plugin-react
Similar issues
-
good first issue help wanted
Difficulty 2/5 Under an hour Newbie friendliness 86/100
Intelligenza-Umana/intelligenza-umana-web#16 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35184 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
danielmiessler/LifeOS#3001 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day