react-native-web-toolkit
v1.0.6
Published
A CLI toolkit to seamlessly add web support to React Native projects using Webpack
Maintainers
Readme
React Native Web Toolkit
A CLI toolkit to seamlessly add web support to React Native projects using Webpack.
Features
- Easy setup of React Native Web in existing React Native projects
- Automated Webpack configuration
- Support for both development and production builds
- Single setup option:
- Webpack configuration for custom control
Prerequisites
- React Native >= 0.81.0
- Node.js and npm installed
Installation
npx react-native-web-toolkitTroubleshooting
Common Issues
Version Mismatch Errors
- React Version Mismatch
Solution: EnsureError: Invalid hook callreactandreact-domversions match exactly. For example:{ "dependencies": { "react": "19.1.1", "react-dom": "19.1.1" } }
Webpack Configuration Issues
@react-native/new-app-screens Error
Error: Unable to resolve module @react-native/new-app-screensSolution: Remove
@react-native/new-app-screensimports fromApp.tsxas they're not supported by react-native-web:// Remove this line from App.tsx - import { ... } from '@react-native/new-app-screens';React Not Found Error
Error: React must be in scope when using JSXor
Error: React not foundSolution: Add React import at the top of your
App.tsx:import React from "react";Loader Not Found Error
Module parse failed: Unexpected token You may need an appropriate loader to handle this file typeSolution: Add the problematic package to Babel loader include paths in
webpack.config.js:{ test: /\.[jt]sx?$/, include: [ path.resolve(appDirectory, 'node_modules/package-name'), // ...other includes ], use: { loader: 'babel-loader' } }
Build Performance Issues
- If the build is slow, try:
- Using
cache-loaderfor frequently used modules - Enabling Webpack's cache in development mode
- Adding heavy dependencies to
externalsif not needed for web
- Using
Development Server Issues
- If hot reload isn't working:
- Check if WebSocket connection is established
- Ensure no port conflicts (default: 8080)
- Clear browser cache and node_modules/.cache
For more specific issues, please check our GitHub Issues page.
