2

I am building a sample react native application. Currently i am running it using the node server.Node server is serving the js file. You can see this in following screenshot:

enter image description here

I want to shift to the option2, for this, if there is any change in the js file, i need to run the curl command manually.

Is there any alternative for this?

rene
  • 41,474
  • 78
  • 114
  • 152
Ashwin Preetham Lobo
  • 1,856
  • 1
  • 14
  • 19

2 Answers2

0

AFAIK there's nothing in place and this is work in progress. See:

https://github.com/facebook/react-native/issues/12

We plan on putting in some sort of build step that "compiles" the JS source directly into a resource file in the app bundle. Obviously in production you wouldn't have a server running nearby.

There's another bit of discussion here.

At the moment I think you're stuck with the curl option.

Colin Ramsay
  • 16,086
  • 9
  • 52
  • 57
0

All this does is packing all your JavaScript together and writing it into a single file. Option 1 has a small http server running, providing the latest packed file when you request it. Option 2 takes the file from the local disk.

You can setup a tool that looks watches your project files and repacks everything if you make changes.

You can do this by yourself, using the packaging tool shipped with react-native (react-native bundle [--minify]) and re-run it everytime things changes using gulp (and gulp-watch).

Also you can use webpack as your packaging tool and use the --watch option. (see example)

mosch
  • 1,005
  • 1
  • 12
  • 24