fs.readdir, glob, fast-glob all won't match any files while using Typescript
Directory Setup:
Client.ts is the file from the snippet.
Here's my tsconfig
6 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OP@Qjuh As requested :)
As you might guess, it is targeting
F:\\...\\dist\\events
yet not including my events dir in there.
I don't know how typescript compilation is supposed to handle this
Yeah, I might have mispoken, but are they supposed to be in dist???
None of the examples provided show that, and the files are certainly in the file I mean to target, and typescript should be static checking that target string right?
Hold on one moment. My brain dead self messed up that code, but I believe my mistake is not the issue
1. I'll link one such in a moment.
2. I am aware, but typescript should be checking dependencies right? Isn't that how people tend to do this with import()
or readsync and such? Maybe I am entirely mistaken. But the example I saw and some others show the commands and events folder within the src directory.
3. Curiously I feel I have the answer and don't for this. When I said static I meant the string with __dirname, "events"
which is a mistake, but I'm sure is not the problem, just an artifact of me switching from glob back to this. But yes, thinking more of course it could not know which files in this string I want access to. Bit of a silly thought there.
4. Typescript is around at compile time, and maybe I'm wrong but does it not check template strings with constants in them?GitHub
djs-typescript-handler/src at master · limxuan/djs-typescript-handler
Contribute to limxuan/djs-typescript-handler development by creating an account on GitHub.
I did yes, though there is one thing I have not tried changing, could
src/**/*.ts
be my issue?
It is not.
Though I was missing import helpers as well
That does not seem to be the problem either.
tsup-node src/index.ts; node dist/index.js
Is there a way to get typescript to preserve file structure?you could not use tsup, a bundler
Yeah, I just found that out.
I thought that src/index.ts would define entry point
I'm annoyed that it was that damn simple. Irritating but sometimes I remind myself how much of an amateur I am.
Was recommended, not sure why, but plenty of people seemed to have it working so I assumed it had to be something else, but yes, that clearly wasn't what was needed.
Fix is this. I'm silly.