import { build } from "esbuild"; import { createPluginBundlerPresets } from "@paperclipai/plugin-sdk/bundlers"; import { fileURLToPath } from "node:url"; import { dirname } from "node:path"; const __dirname = dirname(fileURLToPath(import.meta.url)); const presets = createPluginBundlerPresets({ pluginRoot: __dirname, uiEntry: "src/ui/index.tsx", outdir: "dist", sourcemap: true, minify: false, }); if (!presets.esbuild.ui) { throw new Error("UI preset missing — check createPluginBundlerPresets input"); } await build({ ...presets.esbuild.ui, // Ensure JSX runtime is bundled-resolved at host runtime through React peer. jsx: "automatic", logLevel: "info", }); console.log("[esbuild] UI bundle written to dist/ui/index.js");