Vite playground for @git-diff-view/react.
It can run on top of either the official react or @my-react/react. The implementation is selected at dev/build time through the MY_REACT environment variable, so you never have to edit the source to switch.
From the repository root:
pnpm install
pnpm run dev:reactThe dev server runs at http://localhost:5173/git-diff-view/.
@my-react/react is the default. Use the official react only when you explicitly opt out:
| Command | Runtime |
|---|---|
pnpm run dev:react |
@my-react/react (default) |
MY_REACT=0 pnpm run dev:react |
official react |
pnpm run dev:react:official |
official react |
You can also drop the flag into an .env / .env.local file inside ui/react-example:
# ui/react-example/.env.local
MY_REACT=0MY_REACT only opts out for the values 0, false, no, off (case-insensitive). Any other value — or leaving it unset — keeps @my-react/react.
The selected implementation is printed on startup:
[react-example] React implementation: @my-react/react
vite.config.tsreadsMY_REACTand picks the Vite React plugin accordingly:@my-react/react-vitewhen@my-reactis enabled@vitejs/plugin-reactotherwise
@my-react/react-viteinjectsresolve.aliasentries (react→@my-react/react,react-dom→@my-react/react-dom), so the application keeps importing from"react"as usual.- The resolved flag is also exposed as the compile-time constant
__MY_REACT__(true/false, declared insrc/vite-env.d.ts), which gates@my-react-only UI. - The
devscript usesvite --force, so switching the plugin re-optimizes dependencies automatically — no manual cache cleanup required.
-
CliPlayGroundis built on@my-react/react-terminaland only renders on the@my-reactruntime:<Stack gap="xl"> <ReactPlayGround /> <VuePlayGround /> {__MY_REACT__ && <CliPlayGround />} </Stack>
-
Production build:
pnpm run build(tsc && vite build). In the bundle__MY_REACT__is statically replaced.