Skip to content

fix(rsc): generate sourcemaps for code transforms #1294

Open
Kinfe123 wants to merge 2 commits into
vitejs:mainfrom
Kinfe123:fix/plugin-rsc-sourcemaps
Open

fix(rsc): generate sourcemaps for code transforms #1294
Kinfe123 wants to merge 2 commits into
vitejs:mainfrom
Kinfe123:fix/plugin-rsc-sourcemaps

Conversation

@Kinfe123

Copy link
Copy Markdown
Contributor

Description

Fixes #1122.

Three @vitejs/plugin-rsc hooks changed generated code without returning sourcemaps:

  • rsc:vite-client-raw-import
  • rsc:virtual:vite-rsc/assets-manifest
  • rsc:inject-async-local-storage

This updates those edits to use MagicString and return boundary-level maps, allowing Rolldown to compose correct final sourcemaps instead of reporting SOURCEMAP_BROKEN.

A focused E2E test builds an isolated starter fixture with --sourcemap and verifies the build succeeds without incorrect-sourcemap warnings.

Validation

  • pnpm -C packages/plugin-rsc build
  • pnpm -C packages/plugin-rsc tsc
  • pnpm -C packages/plugin-rsc test --run
  • pnpm -C packages/plugin-rsc test-e2e sourcemap
  • pnpm -C packages/plugin-rsc test-e2e starter
  • pnpm -C packages/plugin-rsc/examples/starter build --sourcemap
  • pnpm exec oxfmt --check packages/plugin-rsc/src/plugin.ts packages/plugin-rsc/e2e/sourcemap.test.ts

@Kinfe123
Kinfe123 marked this pull request as ready for review July 17, 2026 23:37
@Kinfe123 Kinfe123 changed the title fix(rsc): generate sourcemaps for code transforms (fix #1122) fix(rsc): generate sourcemaps for code transforms Jul 17, 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.

Sourcemap is likely to be incorrect warnings on vite build --sourcemap

1 participant