{"id":28425,"library":"typescript-build","title":"TypeScript Build (tsb)","description":"Extends the TypeScript compiler (tsc) with a configurable file copy step, allowing you to copy non-TypeScript assets (CSS, JSON, etc.) from source to output directories after a successful tsc build. Current stable version is 3.1.0. It operates in two modes: TSC mode (runs tsc with given arguments and then copies files) or Copy-only mode (only copies files based on tsbconfig.json). Key differentiator: it automatically follows TypeScript project references, looking for tsbconfig.json next to each referenced tsconfig.json. Requires Node >=14.16 and a peer dependency on typescript itself.","status":"active","version":"3.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/ericvera/typescript-build","tags":["javascript","typescript","build"],"install":[{"cmd":"npm install typescript-build","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-build","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-build","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; tsb runs tsc under the hood","package":"typescript","optional":false}],"imports":[{"note":"tsb is a CLI tool, not a library. Install as dev dependency and use via npx or npm scripts.","wrong":"npx tsc --build","symbol":"tsb (CLI command)","correct":"npx tsb --build"}],"quickstart":{"code":"// 1. Install\nnpm install --save-dev typescript typescript-build\n\n// 2. Create tsbconfig.json at project root\n// {\n//   \"copyFiles\": [\n//     {\n//       \"files\": [\"src/**/*.css\"],\n//       \"outDirectories\": [\"dist\"],\n//       \"up\": 1\n//     }\n//   ]\n// }\n\n// 3. Run build\nnpx tsb --build\n// This runs tsc --build first, then copies matched .css files to dist/","lang":"typescript","description":"Installation, configuration (tsbconfig.json), and build command to copy .css files during TypeScript compilation."},"warnings":[{"fix":"Migrate to tsbconfig.json and upgrade Node to >=10 (v3 requires >=14.16).","message":"v2.0.0 dropped support for Node < 10 and changed configuration format (was .tsbconfig, now tsbconfig.json).","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Upgrade Node to >=14.16.","message":"v3.0.0 requires Node >=14.16 and dropped Node 10/12 support.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Always include --build to trigger file copying.","message":"Copy step only runs when --build flag is provided. Without --build, tsb behaves exactly like tsc (no copying).","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set skipClean: true in tsbconfig.json to prevent deletion of output directories.","message":"Clean removes output directories entirely unless skipClean is true. This may delete files not produced by tsb.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Rename .tsbconfig to tsbconfig.json and update content.","message":"The old configuration file format (.tsbconfig) was removed in v2.0.0.","severity":"deprecated","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev typescript' (or add it to peerDependencies).","cause":"typescript is a peer dependency, not installed automatically.","error":"Error: Cannot find module 'typescript'"},{"fix":"Use 'tsb --build' for building, or run 'tsc --watch' directly for watch mode (copy not supported).","cause":"tsb does not pass --watch to tsc; copy step only works with --build.","error":"tsb: error: unknown option `--watch'"},{"fix":"Create tsbconfig.json at the same directory where you run tsb.","cause":"tsbconfig.json is missing or not in the project root.","error":"No tsbconfig.json found, skipping copy step."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}