-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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(ESModules): importing for esm modules #3998
Conversation
Node.js fully provides support for ECMAScript modules as they provide limited interoperability between them and the existing module format, namely, CommonJS. Due to the increasing popularity of ECMAScript modules, it is utterly reasonable to allow support for ECMAScript modules. One drawback of the change is that it blocks 'subpath imports' if paths are not represented in the import submodule from 'discord.js/esm'; |
I'd argue this is more I assume this is absolutely needed to get modules to work in Node.js? |
Yes this change is required to get modules working in node.js that is why I labeled it as a fix, documentation can be found on this page https://nodejs.org/api/esm.html A workaround is achievable by using the |
Please describe the changes this PR makes and why it should be merged:
This PR fixes #3992 by adding special exports for esm modules.
The exports in the package.json have been inspired by eris with modifications to work with discord.js
I've built a script that automatically can build the discord.mjs file if needed, the script is as follows:
Status
Semantic versioning classification: