gilamran/tsc-watch

Stdout/Console log does not prints

dalisoft opened this issue · 6 comments

Hi @gilamran
Thanks for such great tool which makes life easier.

I found bug if we see this tool as nodemon alternative.

In file i just used console.log, but tsc-watch does not prints it

Example

// log.ts
console.log('Print me!');

log.ts becomes log.ts after compilation

$ tsc-watch --onSuccess "node log.js"

That doesn't sound reasonable... this is a very basic usage and should work with no problems...
Can you share a full demo? Can you share the log.js?

This file even didn’t logged, that’s all content I’ve used.
thanks

Can you share your code?

One-line code has been shown. Thanks for reply and waiting, but seems anyway does not work, i'll close this issue as solved by using tsc+nodemon combo

Lunuy commented

I had similar problem.

# no log
tsc-watch --onSuccess "set NODE_ENV=development && node dist/log.js"

This doesn't print any logs. But If I remove env setting, it works fine.

# yes log
tsc-watch --onSuccess "node dist/log.js"

But what's the difference between two expressions?

Internally tsc-watch is using spawn to start your process. (Without the shell options).
This causes it not to respect the && and || pipes as these are OS specific.
So, currently the onSuccess accepts only one process to run.

I'm considering adding a new flag --runInShell to allow this.

Thanks