An experimental Node.js package providing a high-level API to interface with the Hermes bytecode compiler (HBC). Hermes is an open-source JavaScript engine optimized for React Native apps. This package integrates the compiler as a WebAssembly binary generated via Emscripten, enabling conversion of JavaScript/JSX into Hermes bytecode (.hbc) for improved startup performance on mobile. The current stable version is 0.73.10, with regular releases as part of Metro's release cadence (monthly minor updates). Unlike alternatives like Babel alone, this compiler is purpose-built for Hermes, producing optimized bytecode targeting React Native's Hermes runtime.
npm install metro-hermes-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compiles a JavaScript file to Hermes bytecode using the compile function, with source map and optimization enabled.
Use compiled output directly as a Buffer instead of accessing .buffer.
Replace compileFromSource calls with compile and adjust parameters if needed.
Upgrade Node.js to version 14 or later.
Ensure sufficient memory (at least 512MB heap) for the Node process.
Always include sourceMap and optimize boolean options in the config object.
Run `npm install metro-hermes-compiler` or add it to package.json.
Use `import { compile } from 'metro-hermes-compiler'` (not `import ... from` as default).Ensure the package is installed and import path is correct (use 'metro-hermes-compiler' not a relative path).