rk build
The rk build command builds a Roku RSG 2.0 SDK app without deploying it to a device. It runs a one-time build that produces the app bundle and package-ready artifacts.
See the generated command reference for more information about arguments, options, and defaults.
Usage
The following syntax shows how to run the command:
rk build [options]Running rk build with no options is equivalent to running rk build --release. The build produces minified JavaScript output (not Hermes bytecode), sets __DEV__ to false, and drops console and debugger calls.
Building BrightScript-only apps
When you set app.brsOnly: true, the rk build --local command packages traditional BrightScript/XML files without requiring a tsconfig.json file or emitting JavaScript or Hermes bytecode, even with --compile-ts. The manifest does not have a ts_path entry. The --archive flag still produces an unsigned squashfs .bin file, not ZIP or signed .pkg output. See configuration and asset layout and the BrightScript-only example for more information.
Output
A successful build writes artifacts under dist-build/ by default, or under the directory that you set with outDir in roku-config.ts or pass with --out-dir or -od:
dist-build/bundle/— intermediate staging directory (mirrorspkg-dirstructure plus build artifacts):manifestcomponents/,fonts/,images/, and so on: static assetssource/compiled/index.js— ESBuild output (transpiled JavaScript)index.js.map— ESBuild source map (JavaScript to TypeScript)index.hbc— Hermes bytecode (only when--compile-tsis set)index.hbc.map— Hermes source map (bytecode to JavaScript)<sha>.source.map— Universal source map (bytecode to TypeScript, composed)
dist-build/pkg-dir/— clean package directory (no build artifacts)dist-build/package/*.bin— squashfs package (only when--archiveis used)
You can use rk decode-stack to translate runtime error addresses from the device back to TypeScript source positions using these source maps.
Options
See the generated rk build reference for more information about presets, output options, and deprecated aliases.
Examples
The following examples show common ways to run rk build:
# Standard release build (default: minified JavaScript, __DEV__ false, console dropped)
npx rk build
# Debug build (unminified JavaScript, __DEV__ true, console kept)
npx rk build --debug
# Release build compiled to Hermes bytecode (for on-device execution without cloud compiler)
npx rk build --compile-ts
# Create a squashfs .bin package
npx rk build --archive
# Build into a custom directory
npx rk build --out-dir ../dist
# Build with a specific build type
npx rk build --build-type staging
# Build using a config variant in the same app root
npx rk build --config roku-config-minimal.tsNotes
The following notes describe the default behavior of rk build:
- The Streaming Store compiles the minified JavaScript output to Hermes bytecode during publishing. You can use
--compile-tsto compile locally. - The
buildVariables.__DEV__setting inroku-config.tstakes effect. It sets the config-level dev-blocks flag, and you can override it with--dev-blocksor--no-dev-blockson the CLI. - By default,
rk buildruns TypeScript semantic type checking. You can use--no-typecheckto skip it.
Related documentation
- Generated rk build reference: Lists the arguments, options, and defaults for
rk build. - App configuration: Describes the
roku-config.tsoptions, including the BrightScript-only layout. - rk decode-stack: Describes how to translate runtime error addresses from the device to TypeScript source positions.
- BrightScript-only example: Includes an example BrightScript-only app.
Updated about 5 hours ago