Overview
React Scan provides component name plugins for various build tools through the unplugin interface. These plugins automatically add display names to React components for better debugging.esbuild
Installation
Usage
build.js
With Options
Rollup
Installation
Usage
rollup.config.js
With Options
Rspack
Installation
Usage
rspack.config.js
With Options
Rolldown
Installation
Usage
rolldown.config.js
With Options
Astro
Installation
Usage
astro.config.mjs
With Options
Plugin Options
All build tool plugins share the same options interface:Files to include for transformation.Default:
**/*.{mtsx,mjsx,tsx,jsx}Files to exclude from transformation.Default excludes:
**/node_modules/****/_app.{jsx,tsx,js,ts}(Next.js)**/_document.{jsx,tsx,js,ts}(Next.js)**/api/**/*(Next.js API routes)**/.million/**/*(Million.js)
Plugin enforcement order (Webpack/Rspack only).
Additional transformation flags.
Initializing React Scan
After configuring the build tool plugin, initialize React Scan in your application:src/index.tsx
Flag Details
noTryCatchDisplayNames
Skip adding display names inside try-catch blocks.noStyledComponents
Skip styled-components transformations.noCreateContext
Skip React.createContext transformations.ignoreComponentSubstrings
Ignore components containing specific substrings.Complete Examples
esbuild with React
build.js
Rollup with TypeScript
rollup.config.js
Astro with Multiple Frameworks
astro.config.mjs
Troubleshooting
Plugin not transforming files
- Check the
include/excludepatterns - Verify file extensions match the pattern
- Ensure plugin is loaded in correct order
Build performance issues
Exclude unnecessary files:TypeScript errors
Add type definitions:react-scan.d.ts