Skip to content

fix: detect React Compiler through bundled config wrappers - #1470

Merged
aidenybai merged 1 commit into
mainfrom
codex/fix-1468-vite-compiler-detection
Jul 28, 2026
Merged

fix: detect React Compiler through bundled config wrappers#1470
aidenybai merged 1 commit into
mainfrom
codex/fix-1468-vite-compiler-detection

Conversation

@aidenybai

@aidenybai aidenybai commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • preserve the originating config analysis context when arguments cross imported wrapper functions and re-export aliases
  • detect Vite 8's official defineConfig() + reactCompilerPreset() setup
  • cover wrapped Next.js configs alongside Turbopack, nested config selection, and wrappers that discard the supplied config
  • add a patch changeset

Fixes #1468.

Root cause

The detector could resolve defineConfig into Vite's bundled package implementation, but arguments forwarded through that re-export chain were analyzed against Vite's source file. Imports owned by the user's config, including reactCompilerPreset, were therefore no longer resolvable.

The fix carries each bound expression's originating analysis context through calls and selected object properties. This follows the actual wrapper implementation instead of treating every defineConfig-shaped call as transparent, preserving the negative case where a wrapper discards the compiler-enabled config.

Product brief

  • Job: accurately identify active React Compiler transforms so compiler-gated diagnostics match the user's build
  • Reuse: extend the existing recursive config expression analyzer; no new public option or report field
  • Metric: reuse the existing anonymized project.reactCompiler telemetry dimension
  • Compatibility: behavior-only patch; JSON schema remains unchanged

Validation

  • nr test
  • nr typecheck
  • nr lint
  • nr format:check
  • nr smoke:json-report
  • react-doctor --verbose --scope changed — 100/100, no issues

Note

Medium Risk
Touches recursive static analysis in project discovery; incorrect heuristics could mis-gate compiler-related diagnostics, but scope is limited to detection logic with expanded fixture tests.

Overview
React Compiler detection now follows config arguments through bundled wrapper functions (Vite defineConfig, Next.js-style helpers) instead of analyzing them only inside the wrapper package, so user-owned imports like reactCompilerPreset and reactCompiler flags resolve correctly.

The config analyzer threads originating analysis context with each bound expression (ConfigExpressionReference / ConfigPropertyReference), including when crossing imported re-exports and function parameters. Wrappers that discard the passed config still evaluate as no compiler.

Tests cover Vite 8 defineConfig + reactCompilerPreset, and parameterized Next.js bundled wrappers (pass-through, nested selection, discard). Patch changeset for @react-doctor/core and react-doctor.

Reviewed by Cursor Bugbot for commit a8613eb. Bugbot is set up for automated code reviews on this repo. Configure here.

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1470
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1470
npm i https://pkg.pr.new/react-doctor@1470

commit: a8613eb

@aidenybai
aidenybai marked this pull request as ready for review July 28, 2026 10:03
@github-actions

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

React Doctor interactive terminal recording

Recorded from the built CLI at a8613eb in a real terminal. The fixture holds Git busy for three seconds, so Scanning... must appear immediately after project selection, then exercises the compact interactive report.

Download the GIF and MP4 artifact

@aidenybai
aidenybai merged commit f1a1b16 into main Jul 28, 2026
28 of 29 checks passed
@aidenybai
aidenybai deleted the codex/fix-1468-vite-compiler-detection branch July 28, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React Compiler detection misses reactCompilerPreset with @rolldown/plugin-babel

1 participant