CLI Configuration
Minimajs is configured via a minimajs.config.ts file in the root of your project.
ts
import { defineConfig } from "@minimajs/cli";
export default defineConfig({
entry: ["src/index.ts", "src/**/module.ts"],
outdir: "dist",
});Options
| Option | Type | Default | Description |
|---|---|---|---|
entry | string[] | ["src/index.ts", "src/**/module.ts"] | Entry points or glob patterns |
outdir | string | "dist" | Output directory |
clean | boolean | true | Clean output directory before each build |
check | boolean | true | Run TypeScript type checking in watch mode |
minify | boolean | false | Minify output |
sourcemap | boolean | false | Emit source maps |
tsconfig | string | "tsconfig.json" | Path to tsconfig |
watch | boolean | false | Watch for changes |
run | boolean | false | Run the output after build |
import | string[] | [] | Additional entry points to import at startup |
loader | Record<string, Loader> | {} | Custom esbuild loaders |
killSignal | NodeJS.Signals | "SIGTERM" | Signal used to stop the running process |
plugins | MinimaPlugin[] | [] | Minimajs CLI plugins |
esbuild | EsbuildOverrides | — | Raw esbuild options (merged last) |
Plugins
Plugins extend the CLI build pipeline. A plugin can contribute entry glob patterns and/or hook into the esbuild lifecycle via setup.
ts
import { defineConfig } from "@minimajs/cli";
import type { MinimaPlugin } from "@minimajs/cli";
const myPlugin = (): MinimaPlugin => ({
name: "my-plugin",
entry: ["src/**/worker.ts"],
});
export default defineConfig({
plugins: [myPlugin()],
});With the above plugin, any src/*/worker.ts file is automatically picked up as a build entry — no manual registration needed.
Hooking into esbuild
If a plugin needs to transform files or intercept the build, implement setup:
ts
const myPlugin = (): MinimaPlugin => ({
name: "my-plugin",
entry: ["src/**/worker.ts"],
setup(build) {
build.onLoad({ filter: /\.txt$/ }, (args) => ({
contents: `export default ${JSON.stringify(args.path)}`,
}));
},
});Plugins without
setupare not registered with esbuild — only theirentrypatterns are used.
esbuild Passthrough
Pass raw esbuild options that are merged into the final build config. Managed options (entryPoints, outdir, plugins, metafile, bundle, platform, format, splitting) cannot be overridden.
ts
import { defineConfig } from "@minimajs/cli";
export default defineConfig({
esbuild: {
define: {
"process.env.VERSION": JSON.stringify("1.0.0"),
},
banner: {
js: "// generated by minimajs",
},
},
});