Skip to content

Conversation

@raarts
Copy link
Contributor

@raarts 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'.

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/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@brentvatne
Copy link
Member

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
Copy link
Member

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 WIP: Add react-native-web to the template Add react-native-web to the template Mar 16, 2018
@brentvatne brentvatne merged commit 49b665f into expo:master Mar 16, 2018
@raarts raarts deleted the web-support branch March 16, 2018 09:27
@necolas
Copy link

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
Copy link

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 join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants