Minimal bundler/runner for javascript and typescript files. Uses esbuild under the hood for fast transpilation.
npm i -D @ersbeth/tsbuild
Transpile a TS file and generate types:
npx tsbuild -f examples/typescript.example.ts -o tmp/ --types
Transpile all files in a folder :
npx tsbuild -d examples/ -o tmp/
Run transparently a TS file (clears built files after execution)
npx tsbuild -f examples/typescript.example.ts -o tmp/ --run --clear
Bundle and run a TS file on the fly:
npx tsbuild -f examples/bundle.example.ts -o tmp/ --bundle --run --clear
Use a config file instead of / to override CLI parameters:
npx tsbuild -c tsbuild.config.js
export default {
tsbuild: {
dir: "./examples",
out: "./tmp",
types:true,
},
esbuild: {
bundle: true,
packages: 'external',
platform: 'neutral',
target: 'esnext',
sourcemap: true,
}
}
-
--config
,-c
: path to config file -
--file
,-f
: input file -
--dir
,-d
: input dir -
--out
,-o
: output dir -
--clear
: clear built files -
--run
: run built files -
--watch
: auto-rebuild on save -
--types
: generate d.ts files