Hermes: Interaction with CodePush

Created on 15 Jul 2019  路  4Comments  路  Source: facebook/hermes

Hello,

Is Hermes usable with Microsoft's Code Push? Or does the pre-compilation depend on JS assets being in the iOS/Android binary?

question

Most helpful comment

We don't currently have an official strategy or integration with Code Push. However, nothing stops you from pushing your own pre-compiled bytecode files -- they essentially correspond 1:1 to JavaScript bundle files and can be loaded and managed in much the same way.

When given a file, Hermes will examine the header to determine whether it's JS or bytecode and load it accordingly, so you don't have to change anything about how the file is loaded or even which extension it has.

There is one significant caveat though: a bundle compiled with one version of Hermes will not run on a different version.

To maximize efficiency and productivity, we don't try to maintain forward or backward compatibility between versions. If you want to decouple app and code releases through code pushes, you should either stick to a specific version of Hermes, or have a strategy for pushing different bytecode to each applicable Hermes version.

(Specifically, the compiler encodes a bytecode version number in the bundle that the engine verifies on load).

None of this applies to standard apps that just include their bytecode in the APK. In this case you're free to upgrade Hermes at any time since the bytecode will always be compiled with the relevant version.

All 4 comments

IMO, it should be. OTA is one of the USP of RN. And as far as i now, OTA bundle is essentially a zip file, so it can contain image assets and bytecode file.

We don't currently have an official strategy or integration with Code Push. However, nothing stops you from pushing your own pre-compiled bytecode files -- they essentially correspond 1:1 to JavaScript bundle files and can be loaded and managed in much the same way.

When given a file, Hermes will examine the header to determine whether it's JS or bytecode and load it accordingly, so you don't have to change anything about how the file is loaded or even which extension it has.

There is one significant caveat though: a bundle compiled with one version of Hermes will not run on a different version.

To maximize efficiency and productivity, we don't try to maintain forward or backward compatibility between versions. If you want to decouple app and code releases through code pushes, you should either stick to a specific version of Hermes, or have a strategy for pushing different bytecode to each applicable Hermes version.

(Specifically, the compiler encodes a bytecode version number in the bundle that the engine verifies on load).

None of this applies to standard apps that just include their bytecode in the APK. In this case you're free to upgrade Hermes at any time since the bytecode will always be compiled with the relevant version.

@willholen Thanks for the update.
As i understand, An Hermes version upgrade can be treated in the same we as we treat a React-Native version upgrade in OTA. Backward and forward compatibility can work for the app versions which don't involve any change on the native side (Hermes or RN ).

Just a head up, I've created a PR to add Hermes support on CodePush CLI here, feel free to comment:

https://github.com/microsoft/appcenter-cli/pull/627

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thymikee picture thymikee  路  6Comments

akrger picture akrger  路  6Comments

benkane picture benkane  路  5Comments

AMorgaut picture AMorgaut  路  6Comments

swabbass picture swabbass  路  3Comments