-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: named exports for esm users #178
base: master
Are you sure you want to change the base?
Conversation
Looks great! I added it manually to my local installation, thank you! |
Did you test this? 'cause it didn't work for me. This doesn't support ESM completely - it does add exports to the various core files, since they, themeslves, have a dependency on various files, they all need to be ESM modules, themeslves, and therefore have to be renamed to I'm working on converting the whole library's modules to ESM, with the addition of your exports. |
If you mean loading modules from your own files, that won't be implemented anyway (see #122 (comment)). As a workaround, i'm loading all modules manually: async loadModules() {
for (const file of CommandHandler.readdirRecursive(this.commandHandler.directory)) {
const { default: module } = await import(`../../${file}`);
this.commandHandler.load(module);
}
for (const file of ListenerHandler.readdirRecursive(this.listenerHandler.directory)) {
const { default: module } = await import(`../../${file}`);
this.listenerHandler.load(module);
}
} |
The comment says:
I don't understand - why and how is reloading of user-defined Command modules necessary? Also, where do you use |
¯\_(ツ)_/¯
I added it as a method to my client class, doesn't matter where/how you do it though |
Haha, okay. I guess I should ask the 1Computer1, then. |
Also, just to make sure - your |
Thanks, I tried it and it works great! :) |
This PR modifies the way
index.js
re-exports everything so that ESM users can use named exports too. For reference,discord.js
applied this exact change with discordjs/discord.js#6884.Before, this resulted in the following:
Resolves #122.