{"id":18759,"library":"rocket-bundler","title":"Rocket Bundler","description":"Rocket Bundler is the JavaScript bundler for React Native, optimized for fast reload cycles, startup, and bundling speeds. It is designed to scale with thousands of modules and is integrated by default in React Native projects. The current stable version is 0.14.2. Unlike generic bundlers (Webpack, Parcel), it is purpose-built for React Native's Metro-compatible API and ecosystem. It was formerly part of the react-native repository to allow more focused maintenance and faster issue response.","status":"active","version":"0.14.2","language":"javascript","source_language":"en","source_url":"https://github.com/4ndroidev/metro-bundler","tags":["javascript"],"install":[{"cmd":"npm install rocket-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add rocket-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add rocket-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundling engine (forked upstream dependencies)","package":"metro","optional":false},{"reason":"Configuration handling for Metro bundler","package":"metro-config","optional":false},{"reason":"Source map generation","package":"metro-source-map","optional":false}],"imports":[{"note":"ESM named export only; CommonJS require will fail.","wrong":"const rocket = require('rocket-bundler')","symbol":"bundle","correct":"import { bundle } from 'rocket-bundler'"},{"note":"Server class is a named export, not default.","wrong":"import Server from 'rocket-bundler'","symbol":"Server","correct":"import { Server } from 'rocket-bundler'"},{"note":"ESM only; the package does not provide a CommonJS entry point.","wrong":"const { loadConfig } = require('rocket-bundler')","symbol":"loadConfig","correct":"import { loadConfig } from 'rocket-bundler'"}],"quickstart":{"code":"import { bundle } from 'rocket-bundler';\nimport { loadConfig } from 'rocket-bundler';\n\nconst config = await loadConfig({\n  projectRoot: './',\n  transformer: {\n    babelTransformerPath: require.resolve('metro-react-native-babel-transformer'),\n  },\n  serializer: {\n    // custom serializer options\n  },\n});\n\nconst result = await bundle({\n  config,\n  entryFile: 'index.js',\n  platform: 'android',\n  dev: false,\n  bundleOutput: './output.js',\n  sourceMapOutput: './output.map',\n});\n\nconsole.log('Bundle size:', result.stats.files['bundle'].size);","lang":"typescript","description":"Shows how to load configuration and bundle a React Native app using the rocket-bundler API."},"warnings":[{"fix":"Switch to import syntax and ensure your Node.js version supports ESM (>=14.8.0).","message":"rocket-bundler v0.14.0 removed the CommonJS entry point. Require('rocket-bundler') will throw 'ERR_REQUIRE_ESM'.","severity":"breaking","affected_versions":">=0.14.0"},{"fix":"Migrate to using the { bundle } and { Server } imports directly.","message":"The CLI interface (src/cli.js) is deprecated since v0.13.0 and will be removed in v1.0. Use the programmatic API instead.","severity":"deprecated","affected_versions":">=0.13.0"},{"fix":"Set cacheVersion or manually clear caches instead.","message":"The base-file and base-output options (for incremental builds) are not stable across cache clears. Don't rely on them for production caching.","severity":"gotcha","affected_versions":"<0.15.0"},{"fix":"Use 'require.resolve' with absolute paths or configure resolver.nodeModulesPaths.","message":"Rocket Bundler uses a custom resolution algorithm similar to Metro. Node module resolution (require.resolve) may fail in some edge cases with symlinks.","severity":"gotcha","affected_versions":"all"},{"fix":"Explicitly set resolver.resolveRequest to a function that reorders platform-specific extensions.","message":"Platform-specific extensions (e.g., .ios.js, .android.js) are resolved with lower priority than in Metro. This is intentional but may break some existing projects.","severity":"breaking","affected_versions":">=0.12.0 <0.14.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install rocket-bundler@latest. Ensure Node.js >=14.8.0 and that the project's package.json has 'type': 'module' or use .mjs files.","cause":"Package not installed or used in a Node.js version that doesn't support ESM.","error":"Error: Cannot find module 'rocket-bundler'"},{"fix":"Use import { bundle } from 'rocket-bundler'. Do not use const rocket = require('rocket-bundler') as it returns undefined.","cause":"Attempting to import named exports as default or using CommonJS require.","error":"TypeError: (0 , rocket_bundler.bundle) is not a function"},{"fix":"Add bundleOutput: './path/to/output.js' to the options object.","cause":"Missing bundleOutput option in the bundle() call.","error":"Error: Bundle output path not specified"},{"fix":"Implement resolveRequest according to the documentation: it must call getPlatformExtension on the request.","cause":"Custom resolveRequest function not returning a proper extension.","error":"Error: getPlatformExtension is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}