Problem with loader file generator
generate-loader
is generating a loader at unintended location with .js
extension applied 🤔
Also I have nested listeners, so the paths for those are not getting generated porperlySolution:Jump to solution
Fixed it in v1.9.3 @MRDGH2821. I swear I encountered and fixed that bug before but it somehow slipped through the cracks. I swear I had it working when I implemented this.
10 Replies
The
.js
extension is intended, it's done to comply with verbatimModuleSyntax
required in ESM bots. Without it, Node.js would fail to load the file correctly. Those errors are from ESLint I believe, simply disable the rule, although I may suggest you use @sapphire/eslint-config
and @sapphire/ts-config
, which are settings proven to work quite well with Sapphire.
That being said, that {{LOCATION_REPLACEMENT}}
shouldn't happen at all..js
file extension is correct, it works with both ESM and CJS but is required with ESM. If the path would be correct then it would work fine. So it's just 1 problem.Here's my repo if you want to have a look:
(Use
rewrite-sapphire
branch)
https://github.com/MRDGH2821/Discord-Ban-Utils-BotGitHub
GitHub - MRDGH2821/Discord-Ban-Utils-Bot: Discord Ban Utilities for...
Discord Ban Utilities for Mutual Servers! Contribute to MRDGH2821/Discord-Ban-Utils-Bot development by creating an account on GitHub.
So, I got 3 issues:
1. Eslint error of
.js
(will disable the rule)
2. Listener paths not being correctly generated (I have nested listeners)
3. {{LOCATION_REPLACEMENT}}
folder being generated
I generated the loader using this:
Which maybe the reason of 3rd point 🤔
Path for command files are correctly generated through
Wait, actually there are no command paths in it 😬
All of them seem to be listener paths, and that file _load.ts
is meant to be put in listener
folderproblem 2 and 3 are the same as I said. The paths are correct if the file was in the listeners directory. It's reading nested files just fine.
Solution
Fixed it in v1.9.3 @MRDGH2821. I swear I encountered and fixed that bug before but it somehow slipped through the cracks. I swear I had it working when I implemented this.
Ooo thanks!
I'll check it out soon
Works as expected!
Just not in alphabetical order, then again some logical grouping would have been disturbed
I intentionally didn't add any sorting because both vscode and eslin-plugin-import sort differently and I'm sure other people do other stuff too.
Agreed