mini-dev
A minimal dev server with HMR (Hot Module Replacement) for TypeScript, TSX, CSS, and HTML.
Features
- Zero config — Works out of the box
- TypeScript/TSX — On-the-fly transpilation via esbuild
- HMR — Hot module replacement without full page reload
- Simple API — Programmatic and CLI usage
Install
pnpm add @farming-labs/mini-dev
Quick Start
CLI
npx @farming-labs/mini-dev
npx @farming-labs/mini-dev -p 5173 -r ./my-app
npx @farming-labs/mini-dev -l MY-APP
npx @farming-labs/mini-dev -o
npx @farming-labs/mini-dev --host
npx @farming-labs/mini-dev -s
Programmatic API
import { createDevServer } from '@farming-labs/mini-dev';
const { url, stop } = await createDevServer({ port: 3000 });
console.log('Running at', url);
DevServer Class
import { DevServer } from '@farming-labs/mini-dev';
const server = new DevServer({
root: './src',
port: 3000,
host: '0.0.0.0',
verbose: true,
label: 'MY-APP',
});
const { port, url } = await server.start();
Example
See the example directory:
cd example
pnpm dev
Edit App.tsx or style.css and save — changes apply via HMR without a full reload.
API Reference
See docs/API.md for full API documentation.
Development
pnpm install
pnpm build
pnpm test