import { build } from "esbuild"; import { spawn } from "child_process"; /** * @type {esbuild.Plugin} */ const makeAllPackagesExternalPlugin = { name: "make-all-packages-external", setup(build) { const filter = /(oceanic\.js|sqlite3)/; // Whitelist of dumb packages build.onResolve({ filter }, (args) => ({ path: args.path, external: true })); } }; await build({ entryPoints: ["src/index.ts"], bundle: true, plugins: [makeAllPackagesExternalPlugin], platform: "node", target: "esnext", logLevel: "info", outfile: "dist/index.js", minify: true, treeShaking: true, // shake it off shake it offff jsx: "transform", inject: ["components-jsx/runtime.ts"], jsxFactory: "createElement", jsxFragment: "Fragment" }); setInterval(() => {}, 100); if (process.argv.includes("start")) { const proc = spawn("node", ["--env-file=.env", "dist/index.js"], { stdio: "inherit" }); proc.on("close", (code) => process.exit(code)); }