Config & plugins

loadConfig

Async loader for manic.config.ts / manic.config.js merged with defaults — cached per process.

loadConfig(cwd?)

Reads manic.config.ts or manic.config.js from cwd (default process.cwd()), merges with DEFAULT_CONFIG, caches the result, and returns Promise<ManicConfig>.

import { loadConfig } from 'manicjs/config';

const config = await loadConfig();
console.log(config.server?.port);

Used internally by manic dev, manic build, createManicServer, and CLI tooling.


Signature

function loadConfig(cwd?: string): Promise<ManicConfig>;

Caching

Successful loads memoize cachedConfig. Subsequent calls return the same object until the process restarts — critical when authoring plugins that assume stable pointers.


See also

On this page