Overview
Thereact-scan init command automatically detects your project setup and configures React Scan with the appropriate integration.
Supported Frameworks
The CLI automatically detects and configures:- Next.js (App Router and Pages Router)
- Vite (React + Vite projects)
- Webpack (Create React App and custom Webpack configs)
Flags
Skip confirmation prompts.Useful for CI/CD pipelines or automated setups.
Specify the working directory.
Skip package installation.Useful if you want to review changes before installing dependencies.
Usage Examples
Basic Usage
- Detect your project framework
- Show a preview of file changes
- Ask for confirmation
- Install
react-scanpackage - Apply configuration changes
Skip Prompts (CI/CD)
Custom Directory
Review Changes Without Installing
What It Does
Detection
The CLI checks yourpackage.json for:
- Framework dependencies (Next.js, Vite, etc.)
- Package manager lock files (package-lock.json, pnpm-lock.yaml, yarn.lock)
- Build configuration files
Next.js Projects
App Router
Adds React Scan to your root layout:app/layout.tsx
Pages Router
Adds React Scan to_app.tsx:
pages/_app.tsx
Vite Projects
Adds the Vite plugin tovite.config.ts:
vite.config.ts
Webpack Projects
Configures Webpack (or suggests manual configuration for Create React App).Output Example
Error Handling
No package.json Found
Unsupported Framework
Directory Does Not Exist
--cwd.