Skip to content

Runtime requirements

A plugin entry is a self-contained IIFE bundle. The build output must match the entry path in plugin.toml; the examples below produce dist/plugin.iife.js.

Create build.ts:

import { mkdirSync } from "node:fs";
mkdirSync("dist", { recursive: true });
const result = await Bun.build({
entrypoints: ["src/index.ts"],
target: "browser",
format: "iife",
minify: true,
naming: "plugin.iife.js",
outdir: "dist",
});
if (!result.success) {
console.error(result.logs);
process.exit(1);
}

Add the build command to package.json:

{
"scripts": {
"build": "bun run build.ts"
}
}

Run npm run build, then confirm that dist/plugin.iife.js exists.

Target ES2023 and bundle every dependency required by the plugin. Do not depend on Node.js built-ins, network APIs, workers, or WebAssembly. Test the completed bundle in Amadeus, not only in the build runtime.

Post-pitch code should preserve the documented pitch-buffer invariants. See Post-pitch hooks.