manic dev
Development server via bun --watch on ~manic.ts, plugin bunfig, and config hot reload.
manic dev
manic dev is the local development entry point. It does not embed the whole server in the CLI process—it spawns Bun with --watch on your ~manic.ts file so filesystem changes reload the server.
Implementation: packages/manic/src/cli/commands/dev.ts.
Lifecycle
What runs
After loadConfig():
-
bunfig.toml— Aggregatesplugin.bunfigstrings frommanic.config.ts.[serve.static].pluginsarrays from multiple plugins are merged into one section; everything else is appended. File starts with# Auto-generated by manic dev — do not edit. Skip writing if there is nothing to emit besides the header. -
Child process:
bun --watch [--preload <absolute-plugin-preload.ts> ...] ~manic.tsEach
plugins[].preloadbecomes two argv tokens:--preloadand the plugin script path.
| Piece | Resolved path | Purpose |
|---|---|---|
| Entry file | ~manic.ts at repo root | Your createManicServer bootstrap |
| Preloads | plugins[].preload absolute paths | Bun executes --preload before ~manic.ts |
-
Environment passed to the child:
Variable Meaning PORT--port/-p, elseconfig.server.port, else 6070HOST0.0.0.0if--network, elselocalhostNETWORKtrueorfalse -
Config watch — If
manic.config.tsormanic.config.jsexists at the repo root,fs.watchdebounces (100ms) kill + respawn after re-importing the config module so plugins and bunfig stay in sync.
Fast Refresh & HMR
React Fast Refresh is driven by the OXC transform pipeline injected during dev transforms (see oxc plugin). Behavior matches standard Fast Refresh expectations (preserve state where possible).
Toggle server.hmr in manic.config.ts if you disable HMR at the framework level (not a manic dev --no-hmr flag—the CLI does not define one).
View transitions
Controlled by router.viewTransitions in manic.config.ts (and runtime setViewTransitions). There is no manic dev --no-view-transitions switch.
CLI flags (supported today)
| Flag | Role |
|---|---|
-p, --port | Sets PORT for the spawned bun process (see CLI Overview for server.port vs PORT). |
--network | NETWORK=true, HOST=0.0.0.0. |
Global manic --help documents all commands.
Plugin preloads
Plugins may declare preload so Bun executes them before ~manic.ts:
// manic.config.ts
import { defineConfig } from 'manicjs/config';
export default defineConfig({
plugins: [
{
name: 'my-plugin',
preload: `${process.cwd()}/plugins/my-plugin-preload.ts`,
},
],
});The dev command expands each preload into --preload flags automatically.