swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.76k stars 73 forks source link

How do I run this from the CLI? #638

Closed jameshfisher closed 2 years ago

jameshfisher commented 2 years ago

Sorry if this is a stupid question, but I'm looking to do something like:

$ echo 'console.log("hello")' > foo.ts
$ npx @swc-node/core foo.ts
npm ERR! could not determine executable to run

I've looked and it seems like the package doesn't include an executable at all. I'm expecting an executable because it advertises itself as an alternative to ts-node.

Brooooooklyn commented 2 years ago

node -r @swc-node/register index.ts

See https://github.com/Brooooooklyn/swc-node/tree/master/packages/register

jameshfisher commented 2 years ago

Oh perfect, thanks! 🚀

(I suggest putting this at the top of the https://github.com/Brooooooklyn/swc-node README, since I expect most people are finding this project as an alternative to ts-node)