Home > Net >  How can i setup react-native-web with nx?
How can i setup react-native-web with nx?

Time:01-13

I need to set up react-native-web with nx, how can I do this?

CodePudding user response:

first, you need to create your nx workspace like the following:

npx create-nx-workspace acme --preset=empty

then you just create the new app you have with

nx g @nrwl/react:app website --style=none

then you can add the react-native-web package:

yarn add react-native-web

there may be some babel errors in serving the app, but most of them could be fixed using the following package.

yarn add -D babel-plugin-react-native-web

now depending on if you're still debugging your code you can use the nx serve command.

nx serve website

or if you want to serve the app online you can just export the app and put the static files behind an Nginx Server.

you can always use nx blog article on how to share react and react-native libraries on your workspace.

  • Related