Replies: 4 comments 2 replies
-
Seems like a good idea to me. But I'm not sure how other cli tools work. I'm currently planning a rewrite of cli, and I'll add an option for it if it still seems good after looking at other projects. |
Beta Was this translation helpful? Give feedback.
-
Has this been implemented yet? Or do we still have to use nodemon to do this? |
Beta Was this translation helpful? Give feedback.
-
Hey @kdy1! If you're looking for other CLI tools, there's tsup (which uses esbuild under the hood) and they have a similar approach, they provide the I would love to see this feature because I want to watch, build, and reload, this flag would be super useful and easy because for now, we need I can even help with code if necessary. |
Beta Was this translation helpful? Give feedback.
-
It would be useful if
swc
could run a command after a successful transpile when--watch
mode is enabled.Something like this to re-run Node with the new files:
swc ./src -d ./dist --watch --onSuccess "node dist/index.js"
Similar to how
tsc-watch
has--onSuccess
:tsc-watch --onSuccess "node dist/index.js"
For now, I'm using a combination of
swc
andchokidar
:swc
watches for changes in./src
and transpiles them to./dist
. Thenchokidar
runsnode
on the updated./dist/index.js
.It works but I expect it's not very efficient to watch both the src and dist folders for changes when
swc
already knows what files have changed. Does anyone have a better solution?In case anyone else needs something similar, here's what the
package.json
scripts look like:Beta Was this translation helpful? Give feedback.
All reactions