(Minecraft Bedrock) Enchanting items in a custom crafting recipe

I have a bit of a problem. I would like to make a behavior pack where you can use a custom crafting recipe to craft items with enchantments on them. But I have not found any documentation or any guides on how to do this. Any ways I can?


If you haven't yet, begin by familiarizing yourself with the Vanilla packs. Within a behavior pack you can define a crafting recipe in the recipies folder of your behavior pack:

Screenshot of the Vanilla pack folder structure.

Unfortunately, crafting does not offer the ability to enchant items. This is instead defined on the item data itself; for example, look at the enchanted apple definition:

{
  "format_version": "1.10",
  "minecraft:item": {
    "description": {
      "identifier": "minecraft:appleEnchanted"
    },
    
    "components": {
      "minecraft:hand_equipped": false,
      "minecraft:stacked_by_data": true,
      "minecraft:use_duration": 32,
      "minecraft:foil": true,
      "minecraft:food": {
        "nutrition": 4,
        "saturation_modifier": "supernatural",
        "can_always_eat": true,
        "effects": [
          {
            "name": "regeneration",
            "chance": 1.0,
            "duration": 30,
            "amplifier": 4
          },
          {
            "name": "absorption",
            "chance": 1.0,
            "duration": 120, // 2 * 60
            "amplifier": 3
          },
          {
            "name": "resistance", // damage resistance
            "chance": 1.0,
            "duration": 300,
            "amplifier": 0
          },
          {
            "name": "fire_resistance",
            "chance": 1.0,
            "duration": 300,
            "amplifier": 0
          }
        ]
      }
    }
  }
}

You'll have to define the crafting recipe and enchantments for your item separately.