BakeNative is under active development. APIs may change.
Skip to Content
BakeNative

Troubleshooting

The screen rebuilds on launch, a bundle is refused, the build fails, or native looks different from web.

The screen rebuilds on launch (remounted)

Symptom: launch metrics show phase == .remounted instead of .adopted, and viewsCreatedOnAdopt is not 0.

Your app's first render on the device differed from the one baked at build time, so BakeNative threw the snapshot away and rendered from scratch. The screen still works; you only lose the instant takeover. mismatch says where the two first diverged:

node count: frame 42, runtime 43
row 7: frame <span> parent 3, runtime <div> parent 3
row 12: text "3" vs "4"

Common causes:

  • Reading the time, a random number, or device state during the first render.
  • Branching on something that is different on the device than during the build.

Render a stable placeholder first and fill the real value in from an effect (example). On iOS, the first-screen cache also re-bakes from the rebuilt screen, so a one-off mismatch fixes itself on the next launch.

A bundle is refused

Symptom: an .error event at launch and nothing drawn, or bundle.isSupported == false.

bundle.incompatibility says why. The bundle is missing its manifest.json, was built by a newer CLI than the app's BakeNative supports, or was compiled for a different Hermes version. Rebuild it with the bake that matches the BakeNative version in your app. See Shipping updates.

hermesc not found

Native targets need the Hermes compiler. Run pnpm hermes in the BakeNative checkout, or point bake at a compiler with BAKE_HERMESC=/path/to/hermesc or --hermesc.

src/App.tsrx must export a component

bake uses the App export, then the default export, then the first exported function. Export your root component under one of those.

Native looks different from web

Open the app in the dev tool and check the Native vs Web inspector. It lists each element's position and size on both sides and the difference. Differences usually come from:

  • Web-only CSS. Native fails closed: pseudo-elements other than ::before / ::after and animations of properties native does not animate (the support list names them) are build errors, so a difference usually comes from an @supports not (-bake-native: true) block, a bake-allow comment or a platform branch (support list).
  • Images. <img> is drawn on every target. A network image that shows on the web but not on Android is usually a cleartext http:// URL, which Android refuses unless the app's Network Security Config allows it (Images).
  • Web fonts. Native uses only the fonts the app bundles with @font-face in a .css file (fonts); a rule inside @supports not (-bake-native: true) is web only.
  • Platform branches. Code behind import.meta.env.BAKE_TARGET renders differently on purpose.

Runaway JavaScript freezes the screen

Set timeLimitMs in BakeNativeView.Options and build with --hermesc-flags "-O -emit-async-break-check". A call that runs longer than the limit is stopped and reported as an error instead of blocking the app.

On this page