This repository has been archived by the owner. It is now read-only.

Add react-native-web to the template #599

Merged
merged 6 commits into from Mar 16, 2018

Conversation

Projects
None yet
4 participants
@raarts
Contributor

raarts commented Mar 15, 2018

yarn web will now start webpack-dev-server, which will show the same screen as the ios/android apps.
yarn build will build for production (into public/assets).

Note this install expo-web as a dependency, and babel-plugin-expo-web to replace all instances of import { .... } from 'expo' with import { .... } from 'expo-web'.

@@ -71,6 +86,8 @@ https://github.com/npm/npm/issues/16991
eject: 'react-native-scripts eject',
android: 'react-native-scripts android',
ios: 'react-native-scripts ios',
web: './node_modules/.bin/webpack-dev-server -d --config ./webpack.config.js --inline --hot --colors --content-base public/',

This comment has been minimized.

@brentvatne

brentvatne Mar 15, 2018

Member

no need to scope with ./node_modules here, we can just do webpack-dev-server

@brentvatne

This comment has been minimized.

Member

brentvatne commented Mar 15, 2018

the direction of this looks great. one request which may complicate things a bit but I think is important to keep this as an opt-in feature until it stabilizes — could we possibly put it under a flag? so create-react-native-app raarts-app --with-web-support for example would be amazing

@brentvatne

This comment has been minimized.

Member

brentvatne commented Mar 16, 2018

ideally we would hide the webpack config but I think web support isn't at a level of maturity where we can get away with that yet. I'm going to land this and publish it in a pre-release so more people can play with it. thanks!

@brentvatne brentvatne changed the title from WIP: Add react-native-web to the template to Add react-native-web to the template Mar 16, 2018

@brentvatne brentvatne merged commit 49b665f into react-community:master Mar 16, 2018

@raarts raarts deleted the raarts:web-support branch Mar 16, 2018

@dalcib dalcib referenced this pull request Apr 21, 2018

Closed

Support for React Native? #4238

@necolas

This comment has been minimized.

necolas commented May 14, 2018

FWIW I think Metro is supposed to support bundling for web now (and code-splitting at some point). So you might be able to rely on the same bundler for all platforms pretty soon.

@sanderlooijenga

This comment has been minimized.

sanderlooijenga commented Jun 14, 2018

After the creating the native app with this argument, and ejecting it, I do have some problems when running npm run ios, due to;

error: bundling failed: Error: Unable to resolve module ./App from …

Did somebody else have this issue as well?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.