I use Visual Studio Code (1.8.1) to write ECMAScript 6 for NodeJS 7.3 (so currently no TypeScript).
I want to run the current script with node from the command line (node ${file}
) every time the script file is saved. Is this possible?
To be clear: NodeJS is not running as server, but used for executing cli scripts.
Advertisement
Answer
You can use ‘run-when-changed’ module to achieve this.
You can use it like:
run-when-changed –watch “src/**” –exec “npm run build”
This will watch file changes in src folder and execute npm build script.