![webpack documentation basic setup webpack documentation basic setup](http://docs2x.smartfoxserver.com/_documents/ExamplesJS/_images/connector-webpack.jpg)
React Native’s Babel preset rewrites ES modules to CommonJS modules, preventing bundlers from automatically performing “tree-shaking” to remove unused modules from your web app build. Install webpack-related dependencies, for example: npm install -save-dev babel-loader url-loader webpack webpack-cli webpack-dev-server ( Metro is the React Native bundler with undocumented web support.) What follows is only an example of a basic way to package a Web app using webpack and Babel. React Native will automatically import the correct variant for each specific target platform. More significant platform differences should use platform-specific files (see the webpack configuration below for resolving *.web.js files):įor example, with the following files in your project: M圜Īnd the following import: import M圜omponent from './M圜omponent' Minor platform differences can use the Platform module. Expo includes web support and takes care of all the configuration work required. If you are interested in making a multi-platform app it is strongly recommended that you use Expo (or learn from the source code for the Web integration). Additionally, 3rd party React Native packages with web support are listed in the React Native Directory. If you have an existing React Native application, there are more areas that require attention and customization before most web bundlers can consume the non-standard JavaScript in packages produced by the React Native ecosystem.
WEBPACK DOCUMENTATION BASIC SETUP HOW TO
How to integrate React Native for Web into an existing React Native codebase.