getsentry / getsentry/sentry-javascript

[Nuxt] Inject debug IDs and release only at build-end

Aperta
#18,974 1 commento 0 reazioni 1 assegnatario Rivendicata da @s1gr1d Vedi su GitHub
Nuxt Task
Lingua principale
TypeScript
Stelle
8.7k
Fork
1.8k
Merge medio
1g 17h
PR unite (30g)
515

Descrizione

### Description

## Problem
Nuxt runs through the build twice (client and server).
1. Nuxt builds client-side
2. Nuxt builds server-side
3. Now all client and server files in `.nuxt/dist` contain one debug ID
4. Nitro builds server-side
5. The whole build output is moved to `.output` and the server-side files which were already included in `.nuxt/dist/server` (the Nuxt build) are touched by the rollup plugin a second time.

This setup causes the Nuxt SDK to include the Vite **and** the Rollup plugin, so all source map files are uploaded. However, this has some drawbacks:
- build-times are longer (as there are more uploads during the build)
- Source-mapping might cause problems because some files are touched twice (by Nuxt and Nitro) ([related issue](https://github.com/getsentry/sentry-javascript/issues/18519) - however, this was fixed with a workaround that checks if a file already contains a debug ID)
- release injection happens twice in some files

## Solution
By using the [Bundler Plugin Manager](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/packages/bundler-plugin-core/src/build-plugin-manager.ts), we can do everything (debug
ID and release injection) at the end of the build.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.