LoaderStrategy: promises.opendir is being broken if using with @vercel/pkg library
Hey There! I'm trying to build the bot into signle executable but there is an issue
When trying to load the listeners, commands etc It fails because of
From what I see PKG has this issue for a long time https://github.com/vercel/pkg/issues/1505 and it's not fixed
https://github.com/sapphiredev/pieces/blob/main/src/lib/strategies/LoaderStrategy.ts#L128
Cause of problem is this line
const dir = await opendir(path);
promises.readdir
work fine
What should I do in this situation?GitHub
fs.stat not working · Issue #1505 · vercel/pkg
What version of pkg are you using? 5.5.2 What version of Node.js are you using? 16.13.1 What operating system are you using? windows 10 What CPU architecture are you using? intel i7 What Node versi...
GitHub
pieces/src/lib/strategies/LoaderStrategy.ts at main · sapphiredev/p...
Piece loader for @sapphire/framework. Contribute to sapphiredev/pieces development by creating an account on GitHub.
Solution:Jump to solution
You can change all your pieces to virtual pieces so no more filesystem calls are performed: https://www.sapphirejs.dev/docs/Guide/additional-information/registering-virtual-pieces
Sapphire Framework
Registering and loading virtual pieces | Sapphire
Virtual pieces differ from normal pieces in that they are not loaded from the file system. Instead, they are registered
3 Replies
Solution
You can change all your pieces to virtual pieces so no more filesystem calls are performed: https://www.sapphirejs.dev/docs/Guide/additional-information/registering-virtual-pieces
Sapphire Framework
Registering and loading virtual pieces | Sapphire
Virtual pieces differ from normal pieces in that they are not loaded from the file system. Instead, they are registered
well yea it's a solution
Thought of it But thought there'd be another way
If you're using @vercel/pkg then I assume you're deploying to Vercel, which is gonna give issues with fs sooner or later anyway.
so it's a good thing to use virtual pieces either way