Version: current


Rollup and Babel are the primary tools that power builds in ts-engine.

Two types of packages are fully supported by ts-engine, Node.js applications and libraries. Because each type of package has different requirements at build time the type of the package must be provided when building.

Building a Node.js application

To build a Node.js application run the following command:

ts-engine build --node-app

A Node.js application produces a single output file.

Entry filesOutput filesModule type

Watching for changes

The build command also supports watching for changes to source code and rebuilding automatically when changes occur.

To build and trigger watch mode run the following command:

ts-engine build --node-app --watch

Minifying output

By default the build output is not minified. Terser is used to minify code if you provide the minify option.

To minify the output run the following command:

ts-engine build --node-app --minify

Typecheck post build

By default a typecheck is not performed during a build, there is a specific typecheck for that. However its often useful to perform typechecking post build automatically and also emit with the emit option when building a library. You can do this with the typecheck option.

To typecheck post build run the following command:

ts-engine build --node-app --typecheck

React support

You can build codebases with React and JSX in them.

To support React run the following command:

ts-engine build --node-app --react


Sourcemaps are produced for every build regardless whether it is a Node.js application or a library.

Bundling dependencies

Sometimes it is useful to bundle dependencies into the output file so you can run the file without node_modules. This makes it easier to use, share and deploy as it is a single file. You can bundle dependencies into a Node.js application or a library with ts-engine.

ts-engine build --node-app --bundle-dependencies

Not all packages can be bundled, ts-engine uses Rollup internally and does not support dynamic calls to require(...) or circular dependencies, as well as other things.

Extending Babel config

Babel config does not need to be provided to ts-engine, however it is possible to extend the config it uses.

Install ts-engine's default babel preset:

yarn add --dev @ts-engine/babel-preset

Add a babel.config.js file in your packages root directory:

module.exports = {
presets: ["@ts-engine/babel-preset"],
// your config goes here

Runtime for Node.js applications

In order to run Node.js applications built via ts-engine without dev dependencies present in a production environment you need to make sure you have @ts-engine/runtime installed a dependency. This is installed for you when you use the new-package command.