Skip to content

Guide

This guide helps you start quickly with xBuild.

Create config.xbuild.ts

ts
import type { xBuildConfig } from '@remotex-labs/xbuild';

export const config: xBuildConfig = {
  variants: {
    main: {
      esbuild: {
        entryPoints: ['src/index.ts'],
        outdir: 'dist',
        bundle: true,
        format: 'esm'
      }
    }
  }
};

Run Build

bash
xBuild

Or target a variant:

bash
xBuild --build main

Useful Docs

TypeScript Autocomplete

json
{
  "compilerOptions": {
    "types": [
      "node",
      "@remotex-labs/xBuild"
    ]
  }
}

Programmatic Build (Without CLI)

xBuild also exports APIs from index so you can create custom builds in code (without using the CLI).

Useful exports:

  • BuildService
  • overwriteConfig
  • patchConfig
  • ServerModule (serve)
  • WatchService (watch)
ts
import { BuildService, overwriteConfig } from '@remotex-labs/xbuild';

overwriteConfig({
  variants: {
    custom: {
      esbuild: {
        entryPoints: ['src/index.ts'],
        outdir: 'dist/custom',
        bundle: true,
        format: 'esm'
      }
    }
  }
});

const service = new BuildService();
await service.build('custom');

Released under the Mozilla Public License 2.0