Skip to main content

Build integration

Build addon screens through builder's UI stage.

The stage uses the project's installed UI toolkit, compiles screen components, links every host and writes resource files and behavior host definitions into the staged packs. It registers generated UI imports and source transformations with Builder's script bundler. Screen sources are detected automatically; stage settings select additional modules, formatting and test metadata.

Addon code imports components and hooks from @bedrock-core/ui. Compiler code runs during the build.

Compiler entry​

The package entry supplies complete compilation and linking operations for build integrations:

ExportKindDescription
compileScreenFunctionCompile one native container screen
compileFormScreenFunctionCompile one action or modal form screen
buildUiPackFunctionLink the complete screen set into resource documents and hook merges

ScreenSpec, FormScreenSpec, CompiledScreen, CompiledFormScreen and CompiledUiPack describe the inputs and results. These operations use one addon namespace and the same installed runtime as the screen components.

External build pipelines​

  1. Configure the behavior and resource packs as named pack IDs. Set owner and resourcePack in the profile's ui-compiler settings when several packs could own the UI. Pack ownership
  2. Run Builder's UI and script stages as one automated build step. The UI stage writes the pack resources and adds @bedrock-core/generated/ui to the staged script entry. If a custom Builder stage supplies the script bundler, bundle that staged entry with the generated import mappings from context.generatedImportsFor(packId) and the applicable context.bundleExtensions. BuildContext · BundleExtension
  3. Package the resulting behavior and resource packs together. Keep the generated screen JSON, UI definitions, hooks and language entries in the resource pack. Container screens also need the updated entity or block definitions and generated protocol items in the behavior pack. Start those screens with createContainerScreen in the behavior script. Compiler output · Container screens

Export callable UI functions from your behavior entry if other gameplay modules open your screens. Resolve the generated registration and those functions to the same @bedrock-core/ui runtime and screen component instances. Compiled screen registration uses component identity. Compiled screens

External testing tools​

The versioned metadata types and schema are available through @bedrock-core/ui-compiler/testing and @bedrock-core/ui-compiler/testing/schema. Test metadata describes consuming them independently of the game runtime.