{"id":26596,"library":"vite-plugin-react-esbuild","title":"vite-plugin-react-esbuild","description":"A Vite plugin for React that uses esbuild for JSX/TSX transformation and babel for React Fast Refresh in development, and esbuild exclusively in production. Current stable version is 0.1.2. It aims to provide faster builds by leveraging esbuild where possible, with a similar API to @vitejs/plugin-react. Key differentiator: esbuild-based transform for both development and production, unlike @vitejs/plugin-react which uses babel for development. Release cadence is not well-defined, as it is a relatively new plugin.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/Dunqing/vite-plugin-react-esbuild","tags":["javascript","vite","plugin","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-plugin-react-esbuild","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-react-esbuild","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-react-esbuild","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to function as a Vite plugin","package":"vite","optional":false},{"reason":"peer dependency required for JSX/TSX transformation","package":"esbuild","optional":false}],"imports":[{"note":"The default export is the plugin function; named export does not exist.","wrong":"import { react } from 'vite-plugin-react-esbuild'","symbol":"default","correct":"import react from 'vite-plugin-react-esbuild'"},{"note":"Options type is exported as a named type, not a value. Use type import to avoid bundling.","wrong":"import { ReactPluginOptions } from 'vite-plugin-react-esbuild'","symbol":"ReactPluginOptions","correct":"import type { ReactPluginOptions } from 'vite-plugin-react-esbuild'"},{"note":"CommonJS require returns the default export directly; destructuring is incorrect.","wrong":"const { react } = require('vite-plugin-react-esbuild')","symbol":"require()","correct":"const react = require('vite-plugin-react-esbuild')"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from 'vite-plugin-react-esbuild'\n\nexport default defineConfig({\n  plugins: [\n    react({\n      // Same options as @vitejs/plugin-react\n      jsxImportSource: 'react',\n      babel: {\n        plugins: []\n      }\n    })\n  ]\n})","lang":"typescript","description":"Shows how to configure the plugin in vite.config.ts with a typical setup."},"warnings":[{"fix":"Update Vite to ^3.0.0 and esbuild to >=0.14.51.","message":"Requires Vite 3+ and esbuild >=0.14.51. Older versions are not supported.","severity":"breaking","affected_versions":"< 0.1.0"},{"fix":"Use the babel option only for development-specific plugins; for production, configure esbuild options if needed.","message":"The babel option is only for development; in production babel is not used.","severity":"deprecated","affected_versions":">= 0.0.0"},{"fix":"Check the plugin's source code or issues for list of supported options.","message":"Options are the same as @vitejs/plugin-react, but some options may not be fully supported due to esbuild limitations.","severity":"gotcha","affected_versions":">= 0.0.0"},{"fix":"Do not rely on Fast Refresh in production builds.","message":"React Refresh is only enabled in development; ensure you have a compatible setup.","severity":"gotcha","affected_versions":">= 0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install vite-plugin-react-esbuild --save-dev` and ensure vite and esbuild are installed.","cause":"Package not installed or incorrect peer dependencies","error":"Error: Cannot find module 'vite-plugin-react-esbuild'"},{"fix":"Use `import react from 'vite-plugin-react-esbuild'` (default import).","cause":"Importing the plugin as named export instead of default","error":"TypeError: react is not a function"},{"fix":"Run `npm install esbuild@>=0.14.51 --save-dev`.","cause":"esbuild peer dependency not installed","error":"Error: [vite] Cannot find module 'esbuild'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}