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

Aperta
#1,393 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript, vite
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
297
Fork
88
Merge medio
5h 29m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-wizard

Tutte le issue di getsentry/sentry-wizard

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.