ShardingManager doesnt work with .ts files
I am trying to make a discord bot with typescript that uses shards, however the sharding manager crashes when I pass in a ts file like so:
here is my tsconfig:
Is there any way to get this to work?
8 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.[email protected]
node version: v18.14.0
You want to refer to the javascript file in your dist folder there, as that's what node can work with.
What do you mean?
ohh ok, but that means I need to compile it every time
Is there some way I can make it autocompile before getting there?
I don't think you can, but you are already transpiling your sharding manager file, aren't you?
You can pass the
--watch
flag to tsc
to automatically retranspile when changes are detected.
https://www.typescriptlang.org/docs/handbook/compiler-options.htmlhmm alright, I mean im using nodemon, it would be good if I could hook just add this on
I'm not sure how that would work in combination, but maybe you can let it watch the
dist
folder, which tsc
writes into? hmm ok ill keep looking,
not sure, I moved to tsc-watch and ended up with this:
and
so it just compiles it, then runs it.