4 ms·
I always found it easier to avoid `ts-node` as it introduced a bunch of small compat issues. Since TS 4.5 and their support for `.mts`, I finally settled on ju
by demurgos 3y ago
I always found it easier to avoid `ts-node` as it introduced a bunch of small compat issues.
Since TS 4.5 and their support for `.mts`, I finally settled on just chaining `tsc --build && node ./build/main.mjs`.
- khalidx 3y agoI generally agree with your statement, but have found ts-node incredibly valuable especially when developing servers or CLIs where I want to start/restart the process many times without a build step every time.
- SahAssar 3y agoNode has a built in watch mode and so does tsc. So if you start both you should get what you want.
- azangru 3y agoAnd for development?
- demurgos 3y agoWith TS, I get type checking in the IDE; I don't need to rebuild every few seconds. When I actually need to build and test, it's very fast (<2 seconds). I use Yarn workspaces/subprojects and TypeScript references with incremental builds so it's not really an issue. Here is the `package.json` [0] for a serialization lib I did, you can check the `scripts` section: it's very minimal and I'm quite happy with it. I'm an old Gulp maintainer, so for a long time I had heavy Gulp config with a lot of processing. Over the years I could get rid of it. ESM was the last thing holding me back; and now I'm so happy that I can just use a few simple commands. [0]: https://github.com/demurgos/kryo/blob/master/packages/kryo/package.json https://github.com/demurgos/kryo/blob/master/packages/kryo/p...
- beepbooptheory 3y agoor: `tsc --build --watch` and then just have another terminal to run.
- demurgos 3y agoYes, TS now fully supports ESM so the watch mode works great. I'm not used to using it when working in Node, but other people I work with use it all the time.