Open rizrmd opened 1 year ago
So far, does jiti support watch mode?
@szmxx Not yet but you can try listhen CLI which gives you jiti powered watch mode for any dev server.
@pi0 Looking forward, I will try
This repository does not have discussions enabled, and it's not exactly an issue, more of a question / follow-up on the --watch flag usage when it comes to a Discord bot development.
I'm in the process of modernizing the tools and I immediately thought of jiti
to run my app. However during development it is necessary to be able to watch and re-run the app on save instead of cancelling the process, and running it again.
@pi0 you mentioned that we can use listhen
in the meanwhile, however I'm not sure whether it is the right tool for this use case ?
Another solution would be to simply use bun with the watch flag also. I'm curious what's your opinion on what's the best tool for this
@noook If your app is a HTTP server, you can use listhen that uses jiti and does this. If it is not, you can easily create a watcher with @parcel/watcher
and inside it use a jiti import with cache disabled. Also using bun --watch
is a good alternative I sometimes do that too.
I like to introduce a similar feature of the bun to jiti core for live reload but it is mainly less of a priority now and the next goal is v2 (https://github.com/unjs/jiti/issues/174) so maybe after that in 2.x 👍🏼
Was about to ask for a way to achieve this, but found the answer myself hahaha! 🤯🎉🤩
Anyone needing live reload with jiti for tests, there's a temporary (or possibly perpetual) workaround:
pnpx nodemon --exec pnpx jiti path/to/file.ts
.
I've found https://github.com/pygy/esm-reload works pretty well, too.
Hi, Great Job!
It would be nice if jiti can watch current project and live reload it when some file changes.