/hermes-windows

Hermes is a small and lightweight JavaScript engine optimized for running React Native apps..

Primary LanguageC++MIT LicenseMIT

Hermes JS Engine

MIT license npm version Fuzzing Status PRs Welcome Hermes logo - large H with wings

Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode.

If you're only interested in using pre-built Hermes in a new or existing React Native app, you do not need to follow this guide or have direct access to the Hermes source. Instead, just follow these instructions to enable Hermes.

Noted that each Hermes release is aimed at a specific RN version. The rule of thumb is to always follow Hermes releases strictly. Version mismatch can result in instant crash of your apps in the worst case scenario.

If you want to know how to build and hack on Hermes directly, and/or integrate Hermes built from source into a React Native app then read on.

The instructions here very briefly cover steps to build the Hermes CLI. They assume you have typical native development tools setup for your OS, and support for cmake and Ninja. For more details of required dependencies, building Hermes with different options, etc. follow these links instead:

To build a local debug version of the Hermes CLI tools the following steps should get you started on macOS/Linux: The following commands should get you going in a Windows Command Prompt:

mkdir hermes_workingdir
cd hermes_workingdir
git clone https://github.com/facebook/hermes.git
cmake -S hermes -B build -G Ninja
cmake --build ./build

Or if you're using Windows, the following should get you going in a Git Bash shell:

mkdir hermes_workingdir
cd hermes_workingdir
git -c core.autocrlf=false clone https://github.com/facebook/hermes.git
cmake -S hermes -B build -G 'Visual Studio 16 2019' -A x64
cmake --build ./build

You will now be in a directory with the output of building Hermes into CLI tools. From here you can run a piece of JavaScript as follows:

echo 'use strict'; function hello() { print('Hello World'); } hello(); | .\bin\Release\hermes.exe

For more details on Hermes for Android, see here.

Contributing

The main purpose of this repository is to brings Hermes support to React Native Windows. We are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can participate.

Code of Conduct

Both Microsoft and Facebook have adopted Codes of Conduct that we expect project participants to adhere to. Microsoft's Code of Conduct can be found here and Facebook's here. Please read through them so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our contributing guide to learn about our development process as well as how to propose bugfixes and improvements.

License

Hermes is MIT licensed.