Add some useful custom components in Minecraft Bedrock Edition.
First, install the npm pack:
npm install lazuli-component
Then, registry the custom component with the component's registry method, such as:
import { CustomWeaponComponent } from "lazuli-components";
CustomWeaponComponent.registry();
After registied it, add following code your item JSON file:
"minecraft:custom_components": ["lazuli:custom_weapon"]
Finally, use the bundler to pack your script file.
If you use esbuild, add --bundle to the pack command.
Download components.js from the release attachment, copy this file to the scripts directory of your behavior pack.
Finally, add following code to the entrypoint script:
import "./components.js" // The path to the 'components.js' in your behavior pack