Emit valid rolldown-vite options in generated vite.config.js

Merged
MA
2mo ago
+25-2

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Description

Found during 0.9.9a1 pre-release testing (FINDING-012/015/019). Every prod build/export logs two rolldown-vite warnings, twice each (client + ssr environment builds):

  • Warning: Invalid input options (1 issue found) - For the "jsx". Invalid key: Expected never but received "jsx".
  • WARN advancedChunks option is deprecated, please use codeSplitting instead.

The generated .web/vite.config.js (template in packages/reflex-base/src/reflex_base/compiler/templates.py) passes two legacy options in build.rollupOptions:

  • jsx: {} — carried over from the remix/react-router migration (#4984). jsx is no longer a rolldown input option (JSX is handled by vite/oxc; rolldown moved it under transform.jsx), so rolldown-vite 8.x rejects and ignores it — it is a no-op today, and dropping it preserves current behavior exactly.
  • output.advancedChunks — deprecated by rolldown in favor of output.codeSplitting, which accepts the identical { groups: [...] } shape (confirmed in rolldown 1.2.6's option schema: codeSplitting: boolean | AdvancedChunksSchema). Renamed in place.

Pre-existing since at least 0.9.8 (both pinned rolldown-vite versions 8.0.16 and 8.2.0 warn identically) — not a 0.9.9a1 regression, but advancedChunks is slated for removal so it would eventually break.

Test plan

  • Regression test tests/units/utils/test_utils.py::test_vite_config_template_valid_rolldown_options: asserts the template no longer emits jsx: {} or advancedChunks and emits codeSplitting with the reflex-env group. Fails on unfixed main (template emits jsx: {}), passes with the fix.
  • End-to-end: reflex init --template blank + reflex export --frontend-only --loglevel debug on this branch — both warnings gone from build output, export exits 0, and the build output structure is byte-for-byte identical to the unfixed baseline (the reflex-env chunk is still split out with the same content hash), so chunking behavior is preserved.
  • uv run ruff check . / uv run ruff format . clean; uv run pyright clean on touched files; scoped uv run pytest tests/units/utils/test_utils.py tests/units/plugins/test_embed.py tests/units/compiler all pass (483 passed).

Note: open PR #6959 touches the same template function (plugin import extension + resolveId filter). This change only edits the rollupOptions block, so no duplication — at most a trivial merge conflict in adjacent lines.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EMjBXPozsNeQNSBZecNH8x


Generated by Claude Code