Search code examples
react-nativemetro-bundlerreact-native-hermes

Does Hermes engine in React Native need a minified file as an input?


Currently (at least as of 0.64-rc.3), React Native first runs Metro Bundler / Uglify on sources, and then passes the minified jsbundle to hermesc. I noticed that in at least 2 of my projects disabling the Uglify step in Metro dramatically speeds up Hermes compilation step.

Question is: does Hermes need a minified source at all?

Intuitively, it should not matter at all, since Uglify doesn't do any dead code stripping or other AST optimizations. But I may be missing some crucial details in my understanding.


Solution

  • According to Tzvetan Mikov (Hermes project lead), who has kindly answered this question on Github, Hermes doesn't need any pre-minification:

    No, Hermes doesn't need minified input. Minifiers primarily rename local variables and parameters and perform some simple AST transformations, which have very little, if any, impact on the size and performance of a compiled Hermes bundle. We recommend disabling minification with Hermes, but haven't really pushed for it aggressively since the Metro pipeline also supports JSC which does benefit from minification.