Gathering detailed insights and metrics for @harrytwigg/esbuild-node
Gathering detailed insights and metrics for @harrytwigg/esbuild-node
Build your Typescript Node.js projects using blazing fast esbuild
npm install @harrytwigg/esbuild-node
Typescript
Module System
59.5
Supply Chain
88.6
Quality
74.7
Maintenance
100
Vulnerability
98.9
License
JavaScript (73.66%)
TypeScript (26.34%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
1,194
Last Day
1
Last Week
1
Last Month
12
Last Year
138
MIT License
712 Stars
83 Commits
45 Forks
11 Watchers
1 Branches
13 Contributors
Updated on Jan 31, 2025
Minified
Minified + Gzipped
Latest Version
2.0.6
Package Id
@harrytwigg/esbuild-node@2.0.6
Unpacked Size
14.05 kB
Size
5.58 kB
File Count
12
Published on
Aug 20, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-50%
1
Compared to previous week
Last Month
20%
12
Compared to previous month
Last Year
-86.9%
138
Compared to previous year
1
2
4
Build your Typescript Node.js projects using blazing fast esbuild.
Since esbuild can build large typescript node projects in subsecond speeds, this is quite useful for development builds too if you want to stick with tsc
for production builds.
Please note this library doesnt do typechecking. For typechecking please continue to use tsc.
Recently, Many alternatives have been released that allow using esbuild with nodejs projects.
You could try these too. They solve the same problem but using require hooks instead.
esbuild-node-tsc reads the tsconfig.json and builds the typescript project using esbuild. esbuild is the fastest typescript builder around. The purpose of this library is to read tsconfig and translate the options to esbuild.
You can also perform custom postbuild and prebuild operations like copying non ts files such as json, graphql files, images,etc to the dist folder or cleaning up build folder.
npm install --save-dev esbuild esbuild-node-tsc
npx esbuild-node-tsc
or use the short form.
npx etsc
Additionally, you can add it to your build scripts
1{ 2 "name": "myproject", 3 "version": "0.1.0", 4 "scripts": { 5 "dev": "etsc" 6 } 7}
Then just run
npm run dev
Since esbuild can build large typescript projects in subsecond speeds you can use this library instead of ts-node-dev or ts-node which usually slow down when project scales.
To achieve live reloading:
npm install --save-dev nodemon esbuild-node-tsc esbuild
Then add the following script to package.json
1{ 2 "name": "myproject", 3 "version": "0.1.0", 4 "scripts": { 5 "dev": "nodemon" 6 } 7}
And add a nodemon.json
1{ 2 "watch": ["src"], 3 "ignore": ["src/**/*.test.ts"], 4 "ext": "ts,mjs,js,json,graphql", 5 "exec": "etsc && node ./dist/index.js", 6 "legacyWatch": true 7}
Finally run
npm run dev
In v2.0, esbuild-node-tsc no longer has cpy and rimraf preinstalled and doesnt perform any non source file copying automatically. Instead it exposes prebuild and postbuild hooks which can be used to perform custom operations. See the example below for more details.
By default esbuild-node-tsc should work out of the box for your project since it reads the necessary configuration from your tsconfig.json
But if things are not working as expected you can configure esbuild-node-tsc by adding etsc.config.js
along side tsconfig.json.
Example etsc.config.js
1module.exports = { 2 // Supports all esbuild.build options 3 esbuild: { 4 minify: false, 5 target: "es2015", 6 }, 7 // Prebuild hook 8 prebuild: async () => { 9 console.log("prebuild"); 10 const rimraf = (await import("rimraf")).default; 11 rimraf.sync("./dist"); // clean up dist folder 12 }, 13 // Postbuild hook 14 postbuild: async () => { 15 console.log("postbuild"); 16 const cpy = (await import("cpy")).default; 17 await cpy( 18 [ 19 "src/**/*.graphql", // Copy all .graphql files 20 "!src/**/*.{tsx,ts,js,jsx}", // Ignore already built files 21 ], 22 "dist" 23 ); 24 }, 25};
All of the above fields are optional.
If you want to use different config files for different types of builds you can do so using the param --config
. Example:
"scripts": {
"build": "etsc --config=etsc.config.build.js"
}
MIT
No vulnerabilities found.
No security vulnerabilities found.