JSPM

  • Created
  • Published
  • Downloads 1248220
  • Score
    100M100P100Q178243F
  • License MIT

Compiles your TS app and restarts when files are modified.

Package Exports

  • ts-node-dev

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ts-node-dev) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ts-node-dev

Hacked version of node-dev that uses ts-node under the hood.

It restarts target node process when any of required files changes (as standard node-dev) but shares Typescript compilation process between restarts. This significantly increases speed of restarting comparing to node-dev -r ts-node/register ..., nodemon -x ts-node ... variations because there is no need to instantiate ts-node compilation each time.

Install

yarn add ts-node-dev
npm i ts-node-dev --global

Usage

ts-node-dev [node-dev|ts-node flags] [ts-node-dev flags] [script] [script arguments]

So you just combine node-dev and ts-node options (lookup docs of those packages):

ts-node-dev --fast --respawn server.ts

Also there is additional options specific to ts-node-dev:

  • --compile-timeout (default: 10000 ms) - for how long to wait before report the error that something went wrong with compilation of a file.
  • --prefer-ts (default: false) - for each .js file (that is not in node_modules) will try to check if corresponding .ts version exists and require it.

By defalut to keep things clean it puts cached files to system temp directory, you may change this with --cache-directory option.

Caveats

The good thing is that ts-node-dev watches used tsconfig.json file, and will reinitialize compilation on its change, but you have to restart the process manually when you update used version of typescript or make any other changes that may effect compilation results.

License

WTF.