A Vite plugin that adds React Native Web support to Vite projects. It strips Flow types, aliases `react-native` to `react-native-web`, and transforms .js files as .jsx using ESBuild. Current stable version is 3.1.2, with a moderate release cadence. Key differentiators: first-class Vite integration, supports Expo and non-Expo projects, and defines global variables like `__DEV__` and `process.env.EXPO_OS`. Requires `react-native-web` and `inline-style-prefixer` as peer dependencies.
npm install vite-plugin-react-native-webVerified import paths — ran on the pinned version, not inferred.
This shows how to install and configure the plugin in a Vite project with TypeScript.
Upgrade vite-plugin-react-native-web to >=3.0.0.
If you rely on Expo's manualChunks, re-enable via plugin options: reactNativeWeb({ expo: { manualChunks: true } }).Run `pnpm add react-native-web inline-style-prefixer` in the app directory.
Rename .js files containing JSX to .jsx or configure ESBuild loader.
Upgrade to v3.1.0+.
Run `npm install react-native-web` or `pnpm add react-native-web`.
Ensure this plugin is only used in the Vite config's plugins array, not imported in browser code.
Check that your source files are properly structured and use standard react-native imports.