fix(nuxt): Nuxt 5 server source maps do not reach the original source files

未關閉
#25,323 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

  • #25333 來自 @s1gr1d —— 已關閉,未合併

評估

難度
4/5
預估耗時
3-5 天
新手友好度
15/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
nuxt, typescript, vite

研究方向

Start with the e2e fixture at dev-packages/e2e-tests/test-applications/nuxt-5-sourcemaps/assert-build.ts and enable the commented-out check that server maps reach app/pages/index.vue. The payload says the Nitro environment ignores the service .map files, so the work is in how Vite environments and @nuxt/kit scope plugins, which needs the Nuxt 5 build to be understood first. A linked open pull request (#25333) already exists, so check it before starting. Done means the assertion passes against a real build.

由索引模型根據 Issue 內容生成。

描述

On Nuxt 5, server stack frames resolve to .nuxt/vite/services/ssr/..., not to the .vue and .ts source files.

Root cause

Nuxt 5 builds the server in two steps:

  1. The Vite ssr environment (a Nitro "service") builds the app into .nuxt/vite/services/ssr, with source maps.
  2. The nitro environment bundles that output again into .output/server.

Nitro reads the service output as plain code and ignores the .map files next to it. So the final maps end at the intermediate output and do not chain to the original sources.

Possible fix

TanStack Start with nitro/vite has the same problem. The TanStack Start fix has two parts:

  • In the nitro environment, a load hook returns each service chunk together with its .map, so the bundler composes both maps.
  • The Sentry plugin does not run in the service environment, so the service's debug IDs do not end up in Nitro's output.

The same approach probably works for Nuxt 5. Check how @nuxt/kit scopes Vite plugins to environments: kit 3 and kit 4.6 do this differently.

Tests

In dev-packages/e2e-tests/test-applications/nuxt-5-sourcemaps/assert-build.ts, enable the commented-out assertion that the server maps reach app/pages/index.vue.

主要語言
TypeScript
星號
8.8k
分支
1.9k
平均合併
1 天 8 小時
30 天內合併 PR
744

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。