Use cpx and typescript to watch and serve file changes

 ̄綄美尐妖づ 提交于 2019-12-11 14:38:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!