~/swaraj.dev
Back to all posts
March 23, 20261 min read

RAM Bundles: Shrinking Startup Time in React Native

Learn how enabling Metro's RAM bundles can cut down JavaScript bundle size and improve app launch speed with a few config changes.

performancereact nativemetro

Insight

React Native ships a single JavaScript bundle by default, which means the whole app code is parsed and evaluated on launch. Metro’s RAM bundles split the bundle into many small modules that are loaded on demand, dramatically reducing the initial parsing cost. The trade‑off is a slightly larger total download size, but for most apps the faster startup outweighs it.

Example

// metro.config.js
module.exports = {
  transformer: {
    // Enable RAM bundles (experimental) for Android & iOS
    ramBundle: true,
  },
  serializer: {
    // Optional: create a single file for OTA updates
    createModuleIdFactory: () => (path) => path,
  },
};

Add the config, rebuild with eas build or npx react-native run-android, and you’ll see the bundle split into many small files.

Takeaway

Turn on RAM bundles in production builds to shave seconds off cold starts, especially for large apps. Pair it with code‑splitting (dynamic import()) for maximum impact.