API Reference

build()

Create a Reactus build engine for generating assets, client entries, and page modules.

Create a Reactus build engine for generating assets, client entries, and page modules.

ts
import path from 'node:path';
import { build } from 'reactus';

const cwd = process.cwd();

const engine = build({
  cwd,
  assetPath: path.join(cwd, 'public/assets'),
  clientPath: path.join(cwd, 'public/client'),
  pagePath: path.join(cwd, '.build/pages')
});

Common properties

PropertyDescription
configFinal merged configuration.
pathsOutput paths for assets, clients, and pages.
productionMirrors the underlying builder mode.
routesRoute prefixes inherited from Server.
templatesActive template strings.
viteConfigOriginal Vite config.
sizeCurrent manifest size.
builderThe underlying Builder instance.

Build-all methods

buildAllAssets()

Build and write asset files for every manifest entry.

buildAllClients()

Build and write client hydration entries for every manifest entry.

buildAllPages()

Build and write server page modules for every manifest entry.

Each returns an array of build status objects.

Per-entry methods

set(entry)

Register a page entry in the manifest.

buildAssets(entry)

Build the asset bundle output for one page entry.

buildClient(entry)

Build the client-side hydration entry for one page entry.

buildPage(entry, assets?)

Build the server page module for one page entry.

If assets is omitted, Reactus builds the asset output first so it can inject generated stylesheet names.

Manifest helpers

The build wrapper also exposes manifest helpers such as:

  • open(file)
  • save(file)
  • get(entry)
  • values()