Why You Don't Have to Minify JavaScript Code in React Native Apps
Article Summary
Davyd Narbutovich from Callstack challenges a web development habit that React Native developers can skip entirely. Turns out, minifying JavaScript in your RN apps might be wasted effort.
Since Hermes became React Native's default JavaScript engine in 2022, the traditional minification step has become redundant. The engine handles optimization internally during bytecode compilation, eliminating the need for tools like Terser that web developers rely on.
Key Takeaways
- Hermes delivers 40% faster startup times through bytecode compilation with built elimination
- Expensify benchmark showed minimal difference: 21.79 MB minified vs 21.62 MB unminified
- Skipping minification significantly speeds up React Native build processes
- Dead code elimination happens at bytecode level, not JavaScript level
React Native developers can skip JavaScript minification entirely because Hermes optimizes at the bytecode level, saving build time without sacrificing app size.
About This Article
React Native developers used to follow web practices and minify JavaScript with tools like Terser to cut code size by 10-50%. This changed when Hermes became the default engine in 2022, making that approach pointless.
Davyd Narbutovich points out that Hermes does dead code elimination on its own during bytecode compilation. You don't need a separate minification step in your bundling pipeline anymore.
Skipping minification makes React Native builds faster while keeping app size about the same. The Expensify benchmark found only 0.17 MB difference between minified and unminified bundles.