Building your code

ts-engine can build one or more files at once. As part of the build all TypeScript files within the package are typechecked. All files must be within the src/ directory.

tse build src/index.ts

# build multiple files
tse build src/index.ts src/test-utils/test-harness.ts

By default the output files are in CommonJS format, however ES Module format is also supported. You can configure this with the --output option.



Minify JavaScript output files using terser.


Emit type declarations files.


Opt out of typechecking, this will also stop type declarations being produced.


Watch for changes and rebuild.


Bundle dependencies.


Output module type, cjs or esm. Defaults to cjs.


Output file extension. Defaults to .js.


Build output is written to dist/, the output directory structure matches the input structure. A sourcemap is always produced alongside your output JavaScript file. If you use the --emit-types option then type definitions will also be produced.

src/index.ts -> dist/index.js
             -> dist/
             -> dist/index.d.ts

src/test-utils/test-harness.ts -> dist/test-utils/test-harness.js
                               -> dist/test-utils/
                               -> dist/test-utils/test-harness.d.ts


Babel configuration is supported, see Configuration.