Skip to content
Moku
@moku-labs/native pages

Build profiles

Store, debug and dev: three builds of one app, and what changes between them.

On this page

How it fits together

A run picks one profile. All three are optimized release builds, so what you measure on a phone is what the store app does. The web build sees the choice in MOKU_NATIVE_PROFILE.

Store (default)debug: truedev: true
ForThe storeYour own deviceA tester, through TestFlight or a Play track
TargetsalliOS, Androidall
Page with the editor agentrefusedallowedallowed
build.removeUnusedCommandstrueleft outleft out
MOKU_NATIVE_PROFILEstoredebugdev
Delivered to<outDir>/<target>/<outDir>/<target>-debug/<outDir>/<target>/

Example

scripts/native-phone.ts
import { native } from "../src/native";

await native.start();

await native.cli.build({ target: "android", debug: true });
await native.cli.build({ target: "android", aab: true, dev: true });

await native.stop();
  1. Lands in dist-native/android-debug/, beside the store build.

Debug on Android

Native marks the build so it can never pass for the store app, and installs it next to it.

Debug profile
Application id<app.identifier>.debug
Launcher name<app.name> (debug)
Signing~/.android/debug.keystore, alias androiddebugkey
NetworkCleartext allowed
shellComposed even when system does not name it
Page__MOKU_NATIVE__.build.profile === "debug", console.* forwarded to logcat under the tag moku-page, WebView debugging on, share present

Every patch is idempotent, and the next store or dev build reverts each to the bytes before.

Debug on iOS

Native renames nothing here. The config names the app, and the profile adds three things:

AddedEffect
NSLocalNetworkUsageDescriptionThe local-network prompt.
NSAppTransportSecurity{ NSAllowsLocalNetworking: true }, so ws:// reaches a machine on the LAN. It replaces your own value, in this profile only.
Web Inspectordevtools on the main window and on the tauri crate.

The package README marks this as verified on a simulator only so far.

Dev

The store build with the agent allowed. Native renames nothing. To get a separate test app, give the config a different app.identifier, app.name, app.icon, projectDir and outDir.

src/native-dev.ts
import { createApp } from "@moku-labs/native";

export const nativeDev = createApp({
  config: {
    app: { name: "MyApp Dev", identifier: "com.example.myapp.dev" },
    projectDir: ".moku/tauri-dev",
    outDir: "dist-native-dev"
  }
});
  1. Its own tree: gen/apple is never regenerated for a new id.
  • debug and dev cannot be combined. The pair is refused before the first phase.
  • debug on a desktop target throws. runAll checks every target up front and refuses the whole run.
  • A debug build needs the keystore. With none it fails in codegen, with the keytool command. doctor warns about it in android-debug-signing.
  • The page sees release for store and dev. Only debug shows in __MOKU_NATIVE__.build.profile. Read MOKU_NATIVE_PROFILE at web build time to tell them apart.