Skip to main content

Bundle Generation

Before you can deploy OTA updates, you need to generate JavaScript bundles and assets. This guide covers build-time bundling (recommended) and manual methods, with Hermes support.

This method integrates DOTA into your build process so bundles are created automatically.

Add to android/app/build.gradle:

apply from: "../../node_modules/@d11/dota/android/codepush.gradle"
note

During builds, this Gradle script copies the generated bundle and assets to .dota/android.

Optional: disable automatic copying by setting in gradle.properties:

dotaCopyBundle=false

2. Manual Bundle Generation

Use this method if you need more control over the bundle generation process or need to generate bundles outside of the build process.

# Android
yarn dota bundle --platform android

# iOS
yarn dota bundle --platform ios

CLI Options

Customize with available flags:

Options:
--platform <platform> Specify platform: android or ios (required)
--bundle-path <path> Directory to place the bundle in, default is .dota/<platform> (default: ".dota")
--assets-path <path> Directory to place assets in, default is .dota/<platform> (default: ".dota")
--sourcemap-path <path> Directory to place sourcemaps in, default is .dota/<platform> (default: ".dota")
--make-sourcemap Generate sourcemap (default: false)
--entry-file <file> Entry file (default: "index.ts")
--dev <boolean> Development mode (default: "false")
--base-bundle-path <path> Path to base bundle for Hermes bytecode optimization
-h, --help Display help for command

Example with Options

This will generate bundle in ./custom-path/android/index.android.bundle and assets in ./.dota/android/assets/

yarn dota bundle --platform android --bundle-path ./custom-path

Example with Sourcemap

This will generate bundle and sourcemap in ./.dota/android/

yarn dota bundle --platform android --make-sourcemap
Smaller Patches

For even smaller patch bundles, enable Base Bytecode Optimization (v1.2.0+).