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

Đang mở
#1,393 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, vite
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
297
Fork
88
Merge trung bình
5 giờ 29 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-wizard

Tất cả issue của getsentry/sentry-wizard

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.