Commit Graph

4 Commits

Author SHA1 Message Date
Martín Bigio 54f2586735 Improve error message when devserver is not running
Summary:
public

If Hot Loading is enabled bu the packager server is not running, as the user updates files he'll see red boxes caused by the HMR runtime. The error those red boxes show is pretty weird for the end user. Lets improve the feedback we give!.

Reviewed By: vjeux

Differential Revision: D2795534

fb-gh-sync-id: dcc39e6682e0603bf10d0f5e623433262b745660
2016-01-04 09:56:30 -08:00
Martín Bigio 5f850fbede Pipe `platform` and `bundleEntry` through WebSocket connection
Reviewed By: vjeux

Differential Revision: D2793572

fb-gh-sync-id: 6ce2467b8d528d1a91c1b4fc51741f2502674022
2015-12-29 18:25:28 -08:00
Martín Bigio 4ffb241647 Hot Loading E2E basic flow
Summary:
public

Implement all the necessary glue code for several diffs submitted before to get Hot Loading work end to end:

- Simplify `HMRClient`: we don't need to make it stateful allowing to enable and disable it because both when we enable and disable the interface we need to reload the bundle.
- On the native side we introduced a singleton to process the bundle URL. This new class might alter the url to include the `hot` attribute. I'm not 100% sure this is the best way to implement this but we cannot use `CTLSettings` for this as it's are not available on oss and I didn't want to contaminate `RCTBridge` with something specific to hot loading. Also, we could potentially use this processor for other things in the future. Please let me know if you don't like this approach or you have a better idea :).
- Use this processor to alter the default bundle URL and request a `hot` bundle when hot loading is enabled. Also make sure to enable the HMR interface when the client activates it on the dev menu.
- Add packager `hot` option.
- Include gaeron's `react-transform` on Facebook's JS transformer.

The current implementation couples a bit React Native to this feature because `react-transform-hmr` is required on `InitializeJavaScriptAppEngine`. Ideally, the packager should accept an additional list of requires and include them on the bundle among all their dependencies. Note this is not the same as the option `runBeforeMainModule` as that one only adds a require to the provided module but doesn't include all the dependencies that module amy have that the entry point doesn't. I'll address this in a follow up task to enable asap hot loading (9536142)

I had to remove 2 `.babelrc` files from `react-proxy` and `react-deep-force-update`. There's an internal task for fixing the underlaying issue to avoid doing this horrible hack (t9515889).

Reviewed By: vjeux

Differential Revision: D2790806

fb-gh-sync-id: d4b78a2acfa071d6b3accc2e6716ef5611ad4fda
2015-12-28 16:44:59 -08:00
Martín Bigio 90781d3067 Introduce Packager and App HMR WebSocket connection
Summary:
public

This diff adds infra to both the Packager and the running app to have a WebSocket based connection between them. This connection is toggled by a new dev menu item, namely `Enable/Disable Hot Loading`.

Reviewed By: vjeux

Differential Revision: D2787621

fb-gh-sync-id: d1dee769348e4830c28782e7b650d025f2b3a786
2015-12-28 16:44:32 -08:00