getsentry / getsentry/sentry-javascript

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

Open
#18,974 1 comment 0 reactions 1 assignee Claimed by @s1gr1d View on GitHub
Nuxt Task
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.