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 porperly
No description
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.
Jump to solution
10 Replies
kyra
kyraβ€’5mo ago
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.
Favna
Favnaβ€’5mo ago
.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.
MRDGH2821
MRDGH2821β€’5mo ago
Here's my repo if you want to have a look: (Use rewrite-sapphire branch) https://github.com/MRDGH2821/Discord-Ban-Utils-Bot
GitHub
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.
MRDGH2821
MRDGH2821β€’5mo ago
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:
npx @sapphire/cli gl
npx @sapphire/cli gl
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 folder
Favna
Favnaβ€’5mo ago
problem 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
Favna
Favnaβ€’5mo ago
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.
MRDGH2821
MRDGH2821β€’5mo ago
Ooo thanks! I'll check it out soon
MRDGH2821
MRDGH2821β€’5mo ago
Works as expected! Just not in alphabetical order, then again some logical grouping would have been disturbed
No description
No description
Favna
Favnaβ€’5mo ago
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.
MRDGH2821
MRDGH2821β€’5mo ago
Agreed