{"id":24980,"library":"barely-a-dev-server","title":"barely-a-dev-server","description":"A thin, opinionated wrapper for esbuild that watches and serves TypeScript files as ESM. Current stable version: 0.8.3. Release cadence: irregular, with multiple minor releases in 2024. Key differentiators: minimal codebase (<200 lines), zero runtime dependencies beyond esbuild, automatic source maps, and integrated dev server that maps entry .ts files to .js. Unlike esbuild's own --servedir, this directly serves compiled output with live rebuilds. No CLI, no live reload, no non-TS transformations. Requires Node >=19 or Bun >=1.0.30.","status":"active","version":"0.8.3","language":"javascript","source_language":"en","source_url":"https://github.com/lgarron/barely-a-dev-server","tags":["javascript","typescript"],"install":[{"cmd":"npm install barely-a-dev-server","lang":"bash","label":"npm"},{"cmd":"yarn add barely-a-dev-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add barely-a-dev-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundler and transpiler for TypeScript compilation, watch mode, and file serving.","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require() will fail. Named export, not default.","wrong":"const barelyServe = require('barely-a-dev-server')","symbol":"barelyServe","correct":"import { barelyServe } from 'barely-a-dev-server'"},{"note":"Default import is incorrect; use named import with braces.","wrong":"import barelyServe from 'barely-a-dev-server'","symbol":"barelyServe","correct":"import { barelyServe } from 'barely-a-dev-server'"}],"quickstart":{"code":"// script/build.js\nimport { barelyServe } from 'barely-a-dev-server';\n\nbarelyServe({\n  entryRoot: 'src',\n  dev: true,\n  port: 3333,\n  esbuildOptions: {\n    target: 'esnext',\n  },\n});","lang":"typescript","description":"Starts a dev server on port 3333 that watches and serves TypeScript files from the 'src' directory as ESM with source maps."},"warnings":[{"fix":"If you relied on custom glob patterns, update your entry points to match esbuild's built-in resolution.","message":"v0.6.0 changed file globbing to rely on esbuild, which may break builds expecting custom pattern matching.","severity":"breaking","affected_versions":">=0.6.0 <0.8.0"},{"fix":"Place library files outside entryRoot; only keep actual entry scripts inside.","message":"All .ts files under entryRoot are treated as entry points, potentially generating many output files.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade to >=0.7.0 and use bundleCSS option if CSS bundling is needed.","message":"v0.7.0 introduced bundleCSS option; prior versions do not support CSS bundling.","severity":"deprecated","affected_versions":"<0.7.0"},{"fix":"In <script> tags, set src='./index.js' (not .ts). The href attribute is informational only.","message":"HTML files must reference .js output, not .ts source; the 'href' attribute is not processed by the server.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check your code for ES2022 compatibility; override esbuildOptions.target if needed.","message":"v0.8.0 uses @cubing/dev-config/esbuild/es2022 under the hood, which may change build defaults (e.g., target).","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Update Bun to >=1.0.30 or use Node >=19.","message":"v0.6.1 removed a workaround for Bun; Bun >=1.0.30 is now required.","severity":"breaking","affected_versions":">=0.6.1"},{"fix":"Write a small script calling barelyServe() or run: node -e 'import(\"barely-a-dev-server\").then(s => s.barelyServe({entryRoot: \"src\"}))'","message":"No CLI; you must import and call barelyServe manually or use node -e.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import syntax: import { barelyServe } from 'barely-a-dev-server'","cause":"Trying to use CommonJS require() on an ESM-only package.","error":"Error: Cannot find module 'barely-a-dev-server'"},{"fix":"Correct import: import { barelyServe } from 'barely-a-dev-server'","cause":"Using default import instead of named import.","error":"TypeError: barelyServe is not a function"},{"fix":"Ensure entryRoot is relative to current working directory and contains .ts files.","cause":"Entry root contains .ts files that esbuild cannot resolve; possibly wrong path or missing file.","error":"Failed to resolve entry point \"src/index.ts\""}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}