React Router wizard generates a Vite config that references an undefined `config`

Abierto
#1,393 1 comentario 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
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript, vite
Área
tooling

Línea de trabajo

Start in src/react-router/codemods/vite.ts, reading createSentryPluginCall and addReactRouterPluginToViteConfig to see where the config identifier is emitted. Look for the existing codemod tests for that file, then reproduce the three shapes from the issue: a function config with a differently named parameter, with no parameter, and with a destructured parameter. Done means the generated Vite config builds for each of those, or the wizard declines and prints manual instructions.

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

Descripción

React Router Framework
Environment

@sentry/wizard master (b262ed0, 9.1.0 plus one commit), React Router integration, Vite 7. Reproduced by running the wizard's Vite codemod directly and building with the Sentry plugin stubbed, not a full wizard run.

Steps to Reproduce
  1. Have a function config whose parameter is not named config:
    import { defineConfig } from "vite";
    export default defineConfig(({ mode }) => ({ plugins: [] }));
    
  2. Run npx @sentry/wizard -i reactRouter.
  3. Run vite build.
Expected Result

The build works. The plugin receives the config the function was called with, or the wizard falls back to manual instructions.

Actual Result

The codemod always passes an identifier named config:

export default defineConfig(({mode}) => ({
  plugins:[sentryReactRouter({ /* ... */ }, config)],
  // ...
}));
error during build:
ReferenceError: config is not defined

See createSentryPluginCall and addReactRouterPluginToViteConfig in src/react-router/codemods/vite.ts. From reading the code, functions without a parameter or with a differently named one are affected too.

Lenguaje dominante
TypeScript
Estrellas
297
Forks
88
Merge medio
5 h 29 min
PR fusionados (30 d)
5

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-wizard

Todos los issues de getsentry/sentry-wizard

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.