Skip to content

fix: config schema validation#341

Merged
lazarv merged 1 commit intomainfrom
fix/vite-config-schema
Mar 6, 2026
Merged

fix: config schema validation#341
lazarv merged 1 commit intomainfrom
fix/vite-config-schema

Conversation

@lazarv
Copy link
Owner

@lazarv lazarv commented Mar 6, 2026

This PR brings the react-server.config.* validation schema to full parity with Vite 8, marks internally-hardcoded options as forbidden with clear error messages, and adds a --no-validation CLI flag as an escape hatch.

Problem

The config validation schema was missing many Vite options (e.g. server.ws, server.strictPort, server.allowedHosts, etc.), causing false validation errors when users set legitimate Vite configuration. Additionally, several Vite options that react-server hardcodes internally (like appType, build.target, json) were silently accepted but then overwritten at runtime, leading to confusing behavior.

Changes

Schema parity with Vite 8

Added validators, TypeScript types, JSON Schema definitions, and descriptions for all previously missing Vite config options across every section.

Forbidden options

Introduced a forbidden() validator that produces clear error messages explaining why an option is forbidden and what to use instead. The following options are now forbidden because react-server hardcodes them internally:

--no-validation CLI flag

Added --no-validation to both dev and build commands as an escape hatch. When set, config validation is completely skipped. This is useful if validation incorrectly rejects a valid configuration or when users intentionally need to bypass a forbidden option.

Documentation (EN + JA)

  • CLI docs: Added --no-validation documentation under both development server and build option sections
  • Configuration docs: Added a new "Config validation" section explaining the validation behavior and how to disable it

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
react-server-docs 23cb57c Mar 06 2026, 08:24 PM

@lazarv lazarv merged commit 639d8ef into main Mar 6, 2026
100 of 101 checks passed
@lazarv lazarv deleted the fix/vite-config-schema branch March 6, 2026 21:05
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.

1 participant