{"id":26171,"library":"rebuildjs","title":"rebuildjs","description":"rebuildjs is a reactive esbuild-based build tool and development server for multi-page apps (MPAs), offering a simple, hackable alternative to Vite. It provides functions for both dev (with file watching, incremental builds, and a built-in HTTP server) and production builds. Currently at v0.71.1, it is actively developed with frequent releases. Key differentiators: full MPA focus, minimal configuration, and integration with `rmemo` for reactive state. Types are included. Requires `esbuild` as a peer dependency. The companion server framework `relysjs` (ElysiaJS-based) ties it together for app server usage.","status":"active","version":"0.71.1","language":"javascript","source_language":"en","source_url":"https://github.com/rebuildjs/rebuildjs","tags":["javascript","reactive","multi page apps","web app","web server","esbuild","rmemo","ctx-core","typescript"],"install":[{"cmd":"npm install rebuildjs","lang":"bash","label":"npm"},{"cmd":"yarn add rebuildjs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rebuildjs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for core bundling functionality","package":"esbuild","optional":false}],"imports":[{"note":"ESM only; no CJS support.","wrong":"const rebuildDev = require('rebuildjs').rebuildDev","symbol":"rebuildDev","correct":"import { rebuildDev } from 'rebuildjs'"},{"note":"Named export, not default.","wrong":"import rebuild from 'rebuildjs'","symbol":"rebuild","correct":"import { rebuild } from 'rebuildjs'"},{"note":"For production bundles.","symbol":"bundles","correct":"import { bundles } from 'rebuildjs'"},{"note":"Default export is the module itself; rarely used.","wrong":"import { default as rebuildjs } from 'rebuildjs'","symbol":"default","correct":"import rebuildjs from 'rebuildjs'"}],"quickstart":{"code":"import { rebuildDev } from 'rebuildjs'\n\nconst PORT = process.env.PORT ?? 3000\nconst HOST = process.env.HOST ?? 'localhost'\nconst entry = ['src/index.ts']\n\nasync function start() {\n  const { server, close } = await rebuildDev({\n    entryPoints: entry,\n    outdir: 'dist',\n    port: PORT,\n    host: HOST,\n    onRequest: (req) => console.log(`${req.method} ${req.url}`)\n  })\n  console.log(`Dev server running at http://${HOST}:${PORT}`)\n}\n\nstart()","lang":"typescript","description":"Sets up a dev server with file watching, incremental builds, and logging for a multi-page app."},"warnings":[{"fix":"Update esbuild to ^0.27.3.","message":"ESbuild ^0.27.3 required; older versions may cause build failures.","severity":"gotcha","affected_versions":"<0.27.3"},{"fix":"Use destructured `{ server, close }` or check changelog for migration.","message":"The `rebuildDev` function no longer returns the `watcher` object directly; access via returned object instead.","severity":"breaking","affected_versions":">=0.70.0"},{"fix":"Replace `rebuildWatch` with `rebuildDev`.","message":"`rebuildWatch` is deprecated; use `rebuildDev` with `watch: true` instead.","severity":"deprecated","affected_versions":">=0.71.0"},{"fix":"Use `import` or run in an ESM project.","message":"CJS `require` will not work; package is ESM-only.","severity":"gotcha","affected_versions":">=0.50.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install esbuild: npm install esbuild","cause":"Missing peer dependency esbuild.","error":"Error: Cannot find module 'esbuild'"},{"fix":"Switch to ESM import: import { rebuildDev } from 'rebuildjs'","cause":"Using `require` instead of `import` (CJS vs ESM).","error":"TypeError: (0 , rebuildjs.rebuildDev) is not a function"},{"fix":"Update esbuild to ^0.27.3","cause":"Incompatible esbuild version installed.","error":"Build failed: unexpected version of esbuild"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}