The Catalyst React plugin automatically detects which build tool your project uses and configures itself accordingly. This allows seamless support for both modern Vite projects and traditional Create React App (Webpack) projects.
- Fast HMR - Lightning-fast Hot Module Replacement
- Modern ESM - Native ES modules support
- Optimized builds - Rollup-based production builds
- TypeScript - First-class TypeScript support
- Mature ecosystem - Battle-tested tooling
- Full compatibility - Works with existing CRA projects
- Zero config - Managed by react-scripts
The plugin uses the following priority order to detect your build tool:
The plugin detects Vite if any of the following conditions are met:
viteis listed independenciesordevDependenciesin package.json- A Vite configuration file exists:
vite.config.jsvite.config.tsvite.config.mjs
The plugin detects Webpack if any of the following conditions are met:
react-scriptsis listed independenciesordevDependencieswebpackis listed independenciesordevDependencieswebpack.config.jsexists in the project root
- Vite takes precedence - If both Vite and Webpack are detected, Vite will be used
- This allows for gradual migration from Webpack to Vite
The plugin handles environment variables differently based on the detected build tool:
- Use the
VITE_prefix for environment variables - Example:
VITE_API_URL,VITE_APP_TITLE - Variables are exposed via
import.meta.env
- Use the
REACT_APP_prefix for environment variables - Example:
REACT_APP_API_URL,REACT_APP_TITLE - Variables are exposed via
process.env
Both build tools support the standard .env file hierarchy:
.env- Default environment variables.env.local- Local overrides (not committed to git).env.production- Production-specific variables.env.production.local- Local production overrides
my-vite-app/
├── index.html # Entry HTML (at root)
├── vite.config.js # Vite configuration
├── package.json
├── src/
│ ├── main.tsx # Entry point (or main.jsx)
│ ├── App.tsx
│ └── ...
└── public/ # Static assets
my-react-app/
├── package.json
├── public/
│ └── index.html # Entry HTML (in public/)
└── src/
├── index.tsx # Entry point (or index.jsx)
├── App.tsx
└── ...
If you see an error about no supported build tool being detected:
-
For Vite projects, ensure you have:
npm install vite @vitejs/plugin-react --save-dev
-
For Webpack projects, ensure you have:
npm install react-scripts --save-dev
If the wrong build tool is being detected:
- Check your
package.jsondependencies - Look for conflicting configuration files
- Remember: Vite takes priority over Webpack
If you're migrating from Webpack to Vite:
- Install Vite dependencies
- Create a
vite.config.jsfile - The plugin will automatically detect and use Vite
- Update environment variables from
REACT_APP_toVITE_prefix - Move
index.htmlfrompublic/to project root - Update entry point from
src/index.tsxtosrc/main.tsx(optional)
To see which build tool was detected, check the CLI output when running commands:
Detected build tool: vite
For more detailed debugging information, check the plugin logs during validation, build, or serve operations.