Giter VIP home page Giter VIP logo

ts-node-dev's Introduction

ts-node-dev

Tweaked 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

ts-node dependency version is not fixed, so it will install the latest version by default.

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 (see docs of those packages):

ts-node-dev --respawn --transpileOnly server.ts

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

  • --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.
  • --ignore-watch (default: []) - files/folders to be ignored by node-dev. But also this behaviour enhanced: it will also make up new RegExp of passed ignore string and check absolute paths of required files for match. So, to ignore everthing in node_modules, just pass --ignore-watch node_modules

NB! --ignore-watch will NOT affect files ignored by TS compilation. Use --ignore option (or TS_NODE_IGNORE env variable) to pass RegExp strings for filtering files that should not be compiled, by default /node_modules/ are ignored.

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.

ts-node-dev's People

Contributors

fgnass avatar wclr avatar aseemk avatar greenkeeperio-bot avatar andreypopp avatar pyetras avatar ricardobeat avatar acrazing avatar tiye avatar alex0007 avatar cyjake avatar corpix avatar gasi avatar divanvisagie avatar jvain avatar lovell avatar matthewmueller avatar bronson avatar pomeo avatar jinze avatar hasenj avatar

Watchers

James Cloos avatar Ivan Wang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.