Created by: paularmstrong
Fixes necolas/react-native-web#629
Problem: Current support for react-native-web uses a webpack alias. This causes the entirety of react-native-web to be bundled when building for production. Unfortunately, this means that every single module, used or not, will be bundled. This can grow app sizes by upwards of 50KiB without any benefit.
Solution: react-native-web publishes a babel plugin that handles aliasing of react-native -> react-native-web
and also swaps the import paths so that it doesn't import the entire app, but just the specific modules used. Info at necolas/react-native-web/packages/babel-plugin-react-native-web
Test Plan:
- run
yarn create-react-app test
cd test && yarn add react-native-web
- Add
import { View } from 'react-native';
toApp.js
and use it in place of anydiv
yarn test
yarn start
yarn build
-
yarn eject
and repeat steps 4-6
NOTE: AppVeyor failure looks like a fluke. Can anyone verify?