Alternative script runner
Your repository totally saved me! I can't express enough gratitude. I struggled to make es modules work in node in my own small project for ever emerging new various reasons.
When I just transferred my src folder to your project, it started working miraculously.
Anyway, I have not figured out how to pass inputs to my CLI app, when using concurrently and I have also tried several other approaches previously (mosly inspired from this stack overflow QA).
So this is ultimately what worked for me, just posting it here for reference.
As a bonus, this solution also requires less dependencies and tsc-watch itself is just a tiny wrapper over tsc -w.
{
"scripts": {
"start": "node --es-module-specifier-resolution=node dist/example.js",
"dev": "tsc-watch --onSuccess \"npm start\" --onFailure \"npm start\"",
"build": "tsc"
},
"devDependencies": {
"@types/node": "13.1.8",
"tsc-watch": "^4.0.0",
"typescript": "3.8.0-beta"
}
}
It's still work in progress and I haven't pushed my changes yet, but any future reader will be able to see the result here https://github.com/ackvf/console-menu
ohh that's interesting, thank you for pointing out tsc-watch, never heard about it before!
What do you think would be arguments for nodemon?
Do you know if there is any effect on performance for large projects?
also, will it watch for changes that are not Typescript?
for example if I have .sql in the source directory?
also, will it watch for changes that are not Typescript?
That's an interesting question. I have never thought about that, but I believe tsc -w should have that worked out.
tsc-watch is, as the author claims, just a tiny wrapper around tsc -w which just adds few hooks, such as onSuccess, onFailure and recently also onCompilationComplete https://github.com/gilamran/tsc-watch/issues/76#issuecomment-577113860
Do you know if there is any effect on performance for large projects?
I think tsc-watch should be faster, since there is no intermediary as is the case with tsc -w and nodemon.