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

Aberta
#25,323 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #25333 de @s1gr1d — fechado sem integrar

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
15/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
nuxt, typescript, vite

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
8.8k
Forks
1.9k
Merge médio
1d 8h
PRs com merge (30d)
744

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de getsentry/sentry-javascript

Todas as issues de getsentry/sentry-javascript

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.