Skip to content

Conversation

@Nonolanlan1007
Copy link
Member

This fixes a bug introduced in v2.6.1 that caused errors for users who did not use ESM:

Node.js v20.11.1
/node_modules/@discordanalytics/core/dist/index.js:41
const node_fetch_1 = __importStar(require("node-fetch"));
                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/@discordanalytics/core/node_modules/node-fetch/src/index.js from /node_modules/@discordanalytics/core/dist/index.js not supported.
Instead change the require of /node_modules/@discordanalytics/core/node_modules/node-fetch/src/index.js in /node_modules/@discordanalytics/core/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/node_modules/@discordanalytics/core/dist/index.js:41:35) {
  code: 'ERR_REQUIRE_ESM'
}

@Nonolanlan1007 Nonolanlan1007 self-assigned this Jan 3, 2026
@Nonolanlan1007 Nonolanlan1007 added the bug Something isn't working label Jan 3, 2026
Copy link
Member

@ValDesign22 ValDesign22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@types/node-fetch and node-fetch can be imported only in the core package, no need for them to be imported in the sub-packages

@ValDesign22
Copy link
Member

why not use the native fetch function from node instead of node-fetch?

@Nonolanlan1007
Copy link
Member Author

@Nonolanlan1007 Nonolanlan1007 merged commit 3ef955d into master Jan 3, 2026
5 checks passed
@Nonolanlan1007 Nonolanlan1007 deleted the fix/rollback-node-fetch-to-v2 branch January 3, 2026 10:25
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

🎉 This PR is included in version 2.6.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants