Registry / devops / esbuild-node-tsc

esbuild-node-tsc

JSON →
library2.0.5jsnpmunverified

esbuild-node-tsc is a CLI tool designed to rapidly build TypeScript Node.js projects leveraging the performance of esbuild. Currently at version 2.0.5, the project maintains an active release cadence, frequently updating dependencies and introducing minor features or fixes. Its primary function is to interpret tsconfig.json options and apply them via esbuild, offering significantly faster build times compared to tsc or ts-node for development workflows. A key differentiator is its focus on build speed rather than type-checking, which it explicitly offloads to tsc. It provides prebuild and postbuild hooks for custom operations like cleaning output directories or copying non-TypeScript assets, which became the standard approach since version 2.0.0, replacing automatic file copying.

npm install esbuild-node-tsc
INSTALL
IMPORT
SIG · ESBUILD-NODE-TSC
E
esbuild-node-tsc
devopsjavascriptv2.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build
import { build } from 'esbuild-node-tsc';
const build = require('esbuild-node-tsc').build;
For programmatic use, typically for custom build scripts or integration. The package primarily functions as a CLI tool.
watch
import { watch } from 'esbuild-node-tsc';
const watch = require('esbuild-node-tsc').watch;
For programmatic watch mode, allowing continuous rebuilding on file changes. The package primarily functions as a CLI tool.
ETSCConfig
import type { ETSCConfig } from 'esbuild-node-tsc';
import { ETSCConfig } from 'esbuild-node-tsc';
Import as a type for strongly typing the configuration object in 'etsc.config.js' when writing it in TypeScript.

Demonstrates setting up esbuild-node-tsc for a TypeScript Node.js project with live reloading using nodemon, including custom prebuild/postbuild hooks for cleaning the dist folder and copying non-TypeScript assets like `.graphql` and `.json` files. This setup enables rapid development feedback loops.

{ "name": "my-project", "version": "1.0.0", "scripts": { "dev": "nodemon", "build": "etsc --config etsc.config.js" }, "devDependencies": { "esbuild": "^0.19.0", "esbuild-node-tsc": "^2.0.0", "nodemon": "^3.0.0", "typescript": "^5.0.0", "cpy": "^11.0.0", "rimraf": "^5.0.0", "express": "^4.18.2", "@types/express": "^4.17.21", "@types/node": "^20.0.0" } } // nodemon.json { "watch": ["src"], "ignore": ["src/**/*.test.ts"], "ext": "ts,mjs,js,json,graphql", "exec": "etsc && node ./dist/index.js", "legacyWatch": true } // etsc.config.js module.exports = { esbuild: { minify: false, target: "es2022" }, prebuild: async () => { const rimraf = (await import("rimraf")).default; console.log("Cleaning dist folder..."); rimraf.sync("./dist"); }, postbuild: async () => { const cpy = (await import("cpy")).default; console.log("Copying non-TS assets..."); await cpy( [ "src/**/*.graphql", "src/**/*.json", "!src/**/*.{tsx,ts,js,jsx}" ], "dist" ); } }; // src/index.ts import express from 'express'; const app = express(); const port = process.env.PORT || 3000; app.get('/', (req, res) => { res.send('Hello from esbuild-node-tsc!'); }); app.listen(port, () => { console.log(`Server running at http://localhost:${port}`); });
esbuild-node-tsc --version
Debug
Known issues
breakingVersion 2.0.0 removed 'cpy' and 'rimraf' as direct dependencies and no longer performs automatic non-source file copying. Users must now implement custom prebuild and postbuild hooks in 'etsc.config.js' to handle cleaning output directories or copying assets.
fix
Migrate to using 'prebuild' and 'postbuild' hooks in 'etsc.config.js'. Install 'cpy' and 'rimraf' as dev dependencies if needed for these hooks (e.g., `npm install --save-dev cpy rimraf`).
affects: >=2.0.0
gotchaesbuild-node-tsc does not perform type checking. It focuses solely on fast compilation. Any type errors in your project will not be reported by 'etsc', which can lead to runtime issues if not caught elsewhere.
fix
Run 'tsc --noEmit' in parallel or as a separate step in your build process (e.g., in `package.json` scripts) to ensure type safety. For example, `npm run build && tsc --noEmit`.
affects: >=1.0.0
gotchaThe package requires 'esbuild' and 'typescript' as peer dependencies. Failure to install these explicitly in your project will result in 'Module not found' or 'Cannot find package' errors during execution.
fix
Ensure both 'esbuild' and 'typescript' are installed as dev dependencies: `npm install --save-dev esbuild typescript`.
affects: >=1.0.0
gotchaWhen using 'etsc.config.js', pay attention to the 'esbuild' property. Options specified here will override those inferred from 'tsconfig.json', potentially leading to unexpected build outputs or behavior if not carefully managed.
fix
Review the 'esbuild' options in your 'etsc.config.js' and consult the esbuild documentation to understand their implications, ensuring they align with your desired build behavior and 'tsconfig.json' settings.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild' or its corresponding type declarations.
The 'esbuild' peer dependency is not installed in the project's 'devDependencies'.
fix
Run `npm install --save-dev esbuild` to install the esbuild package locally.
command not found: etsc
The 'esbuild-node-tsc' package is not installed as a local dev dependency or the `npx` command cannot find it.
fix
Ensure `esbuild-node-tsc` is installed via `npm install --save-dev esbuild-node-tsc` and execute it using `npx etsc` or via a `package.json` script (e.g., `npm run dev`).
TypeError: Cannot read properties of undefined (reading 'sync') at file:///path/to/etsc.config.js
Attempting to use a dynamically imported ESM module (like 'rimraf' or 'cpy') synchronously or incorrectly within a CommonJS `etsc.config.js`, or the module itself is not installed.
fix
Ensure 'rimraf' and 'cpy' are installed as dev dependencies. For 'etsc.config.js' hooks, use dynamic `await import('module')` as shown in the package's documentation to load ESM modules correctly.
TypeScript compile errors are not reported after running 'etsc' command, but 'tsc' shows errors when run separately.
esbuild-node-tsc intentionally bypasses TypeScript's type checking for speed, focusing only on efficient code transpilation.
fix
Integrate a separate step for type checking using `tsc --noEmit` into your development or CI/CD workflow to validate types independently of the build process.
Upgrade
Version history
2.0.5latest on npm
Audit
Dependencies
esbuildrequiredCore bundler dependency for processing TypeScript files.
typescriptrequiredRequired for type definitions and tsconfig.json parsing.
Agent activity
2 hits · last 30 days
node
2
Resources