@esmx/vite-react

The React preset for @esmx/vite. It adds @vitejs/plugin-react (JSX transform + Fast Refresh) on top of the base Vite integration, and re-exports everything from @esmx/vite.

Installation

npm
yarn
pnpm
bun
deno
npm install @esmx/vite-react -D

react and react-dom are peer dependencies and must be installed in your project.

Type Exports

ViteReactAppOptions

interface ViteReactAppOptions extends ViteAppOptions {}

Configuration options, identical to ViteAppOptions. The React plugin is injected automatically through the config hook, applying to every build target and the dev server.

Function Exports

createViteReactApp

function createViteReactApp(esmx: Esmx, options?: ViteReactAppOptions): Promise<App>

Create a Vite + React Esmx application instance.

Parameters:

  • esmx — Esmx framework instance
  • options — Vite React application configuration options

Returns:

  • Returns a Promise that resolves to the created application instance
src/entry.node.ts
export default {
  async devApp(esmx) {
    return import('@esmx/vite-react').then((m) => m.createViteReactApp(esmx));
  }
};

Re-exports

This package re-exports all members of @esmx/vite (e.g. createViteApp, BuildTarget, vite), so you can import the base APIs directly from @esmx/vite-react.