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:
| Export | Kind | Description |
|---|---|---|
compileScreen | Function | Compile one native container screen |
compileFormScreen | Function | Compile one action or modal form screen |
buildUiPack | Function | Link 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
- Configure the behavior and resource packs as named pack IDs. Set
ownerandresourcePackin the profile'sui-compilersettings when several packs could own the UI. Pack ownership - Run Builder's UI and script stages as one automated build step. The UI stage writes the pack resources and adds
@bedrock-core/generated/uito the staged script entry. If a custom Builder stage supplies the script bundler, bundle that staged entry with the generated import mappings fromcontext.generatedImportsFor(packId)and the applicablecontext.bundleExtensions. BuildContext · BundleExtension - 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
createContainerScreenin 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.