1

My package.json:

  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon src $NODE_DEBUG_OPTION --exec babel-node",
    "build": "babel src -s -D -d dist",
    "tsc:w": "tsc -w"
  }

I have to run two commands:

npm run dev

And

npm run tsc:w

Is it possible to include the typescript watcher in the dev?

Joe
  • 4,274
  • 32
  • 95
  • 175

1 Answers1

0

You can use pre and post scripts that will run before and after your intended script.

This should run tsc on .ts files, and then browserify on the compiled .js files:

"scripts": {
    "prebuild": "tsc",
    "build": "browserify dev/main.js -o docs/js/main.js"
}

In terminal:

npm run build
Kokodoko
  • 26,167
  • 33
  • 120
  • 197