vite-config-react is a lightweight, modular Vite configuration generator for React projects. Current version 1.2.8 requires Node.js >=18 and Vite 5+. It provides a clean API to generate Vite configs with presets for React, plugins, and features. Unlike manually writing vite.config.ts, it offers a declarative, composable approach with built-in React support, TypeScript types, and extensibility through plugins. Updated regularly with minor releases every few months. Focuses on developer experience and zero-config setup while remaining fully customizable.
npm install vite-config-reactVerified import paths — ran on the pinned version, not inferred.
Generates a basic Vite config with React preset, custom server port, and sourcemaps enabled in build.
Pass presets as an array: presets: [reactPreset()].
Upgrade Node.js to version 18 or higher.
Replace reactPreset({ include: '...' }) with reactPreset({ features: { include: '...' } }).Ensure Vite version is 5 or higher.
Use import syntax. If using CJS project, use dynamic import().
Set { "type": "module" } in package.json or rename file to .mjs and use Node --experimental-modules flag (deprecated).Change to import { defineConfig } from 'vite-config-react'Use correct import: import { reactPreset } from 'vite-config-react'Ensure Vite version >=5 and using vite-config-react exports correctly.