mjmeintjes/boot-react-native

Release build task/example

jellea opened this issue · 7 comments

As far as I can see there's only a development task at the moment which always tries to get the app over websockets. Would be great to have a task which prepares the app for App Store release. Might have some config/tooling laying around for this.

Side note a bit related to this - if you decide to utilise advanced compilation for release build I suggest using react-native-externs, otherwise a lot of required things will be mangled

I've started work on this, on iOS, in a branch: https://github.com/pesterhazy/boot-react-native/tree/feature/dist

It's proving more difficult than I thought:

  • if I use optimizations :none, it doesn't find the dependencies
  • if I use optimizations :whitespace, it misinterprets goog.require as RNpackager's require and fails
  • if I use optimizations :advanced, I see Unhandled JS Exception: Assert failed: c, which is not very informative.

As for :whitespace, apparently RN's packager uses a simple regex to find everything that looks like require(...), and interprets that as a dependency. This appears to be also true for goog.require.

for Unhandled JS Exception: Assert failed: c try setting the compiler option :output-wrapper to true. Sometimes this kind of thing happens when other scripts shadow short name variables in the compiled JS.

@martinklepsch, that's useful, I'll give it a try. I read that the react-native packager wraps everything in a fn as well.

I switched to optimization :simple, which seems like the sweet spot: it munges goog.require sufficiently to not confuse the rn package, and still leaves most things reasonable.

Works on my branch, in case anyone want to give it a try. I also added a bundle step to the dist task. I'll try to clean it up and put up a PR.

PR here: #30

boot dist in example app works fine so far