Spraxium logoSpraxium

Dev Watch and Config Loading

Configure the local development watcher to restart your bot predictably on file changes. Learn the dev block fields, supported config filenames, and how environments are resolved at startup.

The dev block

The dev block controls the local development watcher that restarts your bot process when source files change. All fields are optional. The default entrypoint is src/main.ts and the default debounce is 300 milliseconds; most projects only need to adjust debounce to prevent restart storms during rapid saves.

spraxium.config.ts
import { defineConfig } from '@spraxium/core';

export default defineConfig({
  dev: {
    entrypoint: 'src/main.ts',
    debounce: 500,
    include: ['locales'],
    exclude: ['.spraxium/**', 'dist/**'],
  },
});
FieldTypeDefaultPurpose
entrypointstringsrc/main.ts

File executed by the watcher when restarting the process.

includestring[][]

Additional directories to trigger restarts on change.

excludestring[][]Glob patterns to ignore during file watching.
debouncenumber300

Milliseconds to wait after a change before triggering a restart.

Exclude generated directories

Always add .spraxium/** and dist/** to the exclude list. These directories change during build operations, and watching them causes infinite restart loops that destabilize the watcher process.

Supported config filenames

The framework searches for your config file using the following priority order. In production mode, compiled output is checked first; in all other modes the TypeScript source takes precedence.

PriorityPathMode
1.spraxium/dist/spraxium.config.jsProduction only
2dist/spraxium.config.jsProduction only
3spraxium.config.tsAll modes
4spraxium.config.jsAll modes
5spraxium.config.mjsAll modes

Environment resolution

NODE_ENV is read once during startup and mapped to a ConfigEnv object. This value never changes after the config has been loaded, so all environment-based branching must happen inside your defineConfig callback.

NODE_ENVModeActive flags
productionproductionisProd = true
neutral, staging, testneutralisNeutral = true
Any other valuedevelopmentisDev = true