Build & Distribution
Estimated reading time: 4 minutesThis document introduces the maplebirchFramework build toolchain, build commands, and packaging workflow.
Build Toolchain
Build Commands
Rspack Configuration
Entry and Output
Output is configured as a window-type library exporting as maplebirch:
This means the bundled code mounts the MaplebirchCore instance to window.maplebirch.
TypeScript Compilation
Uses Rspack's built-in SWC loader to compile TypeScript:
- Target:
> 0.5%, not dead, not ie 11 - Supports
.tweefiles as raw text resources (?rawquery parameter)
Development Server
The dev server runs on port 5678 and provides:
- Static file serving (
game/directory) /modList.jsonendpoint: Auto-scans.zipfiles undergame/mods/and lists them/{name}-{version}.mod.zipendpoint: Dynamically creates mod zip files
Place game/index.html (game files) in the project root during development; the dev server automatically serves mod files with hot reload.
Type Declaration Generation
tsup is configured to generate type-only declaration files:
The generated maplebirch.d.ts contains type definitions for all public framework APIs, for use by Mod developers who depend on the framework.
Packaging Workflow
ELK not loaded. Ensure /elk.bundled.js is loaded before the app.
The final .mod.zip file contains:
dist/inject_early.js— Compiled framework codedist/maplebirch.d.ts— TypeScript type declarationsboot.json— Generated fromscmlfield inpackage.json- Other required files
boot.json Generation
boot.json is automatically generated from the scml section in package.json:
