Configuration files
In MCR 3.x, loadConfig() throws if an explicitly requested config does not exist or a discovered config fails to load (including JSON parsing, module syntax and startup errors). All CLI commands exit with a non-zero status for these errors. No strict option is needed. If no custom config is requested and no default config is found, execution continues with existing options.
Loading config file by priority:
- Custom config file:
- CLI:
mcr --config <my-config-file-path> - API:
await mcr.loadConfig("my-config-file-path")
- CLI:
mcr.config.jsmcr.config.cjsmcr.config.mjsmcr.config.json- json formatmcr.config.ts(requires preloading the TypeScript execution module, for example withtsx):
sh
mcr --import tsx -c mcr.config.ts node ./test.jsIf no custom path is given, MCR walks up from the current working directory to find the default config file (via
find-up). Files outside the search path will be ignored.