`release.inject` gives startup chunks new file names on every commit

Abierto
#26,485 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript, typescript, vite, webpack

Línea de trabajo

Start by tracing how release.inject is applied to startup chunks in the bundler plugins, then compare the Vite transformIndexHtml and webpack HTML plugin entry points mentioned in the issue. Check how release values reach the SDK at runtime and how existing tests cover injected releases and output hashes. Done means the selected behavior avoids changing unchanged chunk hashes on each commit, with tests and documentation covering the caching effect.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug
Problem Statement

release.inject defaults to true, and release.name defaults to the current commit. So every chunk that gets the release snippet gets a new content hash on every commit, even when its code did not change.

Since #25541 this only hits startup chunks, but those are exactly the files every returning visitor needs first. Other chunks import them by their hashed file names, so the renames spread from there.

On @sentry/nuxt 10.47, a deploy that changed one image renamed 140 of 147 client files. release: { inject: false } fixed it.

This is a very weird default. A bundler plugin should not break the bundler's content hashing unless you ask it to, and most users will never notice that every deploy throws away their users' cache.

Solution Brainstorm
  • Keep the release out of content-hashed files: inject it into the HTML (transformIndexHtml in Vite, the HTML plugin in webpack) or into one small unhashed file.
  • Or default release.inject to false when the SDK already gets the release some other way (Sentry.init({ release }), framework runtime config).
  • Either way, document the caching cost on release.inject.

Debug IDs are not the problem: they come from the file content, so they don't change the hashes.

Additional Context

Same problem in the old repo: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/680 (closed, but people still hit it there).

Workaround: release: { inject: false }, and pass release to Sentry.init at runtime.

Lenguaje dominante
TypeScript
Estrellas
8.8k
Forks
1.9k
Merge medio
1 d 8 h
PR fusionados (30 d)
744

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/sentry-javascript

Todos los issues de getsentry/sentry-javascript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.