问题
I am using cpx to copy .yml
files and typescript to compile .ts
files. All of this is then served with an npm script using node as follows:
start: "tsc && cpx \"src/**/*.yml\" dist/src && node ./dist/server.js
This functions without a problem on the production server. The problem arises when I try to run the setup in watch mode during development using tsc-watch as follows:
"start:watch": "cpx \"src/**/*.yml\" dist/src --watch && tsc-watch --onSuccess \"node ./dist/server.js\" --onFailure \"echo Beep! Boop! Compilation Failed!\""
I get the failure message Beep! Boop! Compilation Failed! when I run npm run start:watch
which however changes to what I would expect when the compilation was successfully. The app then runs correctly.
Is it possible to use tsc-watch
together with another script command in watch mode without getting this confusing behaviour?
来源:https://stackoverflow.com/questions/54158954/use-cpx-and-typescript-to-watch-and-serve-file-changes