You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
We have setup an express app with TypeScript, and target CommonJS modules (which is still the default in TypeScript). Consequenty, we don't have "type": "module" in package.json. When we install a version => 2.0.0 of express-request-id, and start the app, it crashes with the following error:
/Users/hermangruber/IdeaProjects/express-example/dist/index.js:8
const express_request_id_1 = __importDefault(require("express-request-id"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/hermangruber/IdeaProjects/express-example/node_modules/express-request-id/index.js from /Users/hermangruber/IdeaProjects/express-example/dist/index.js not supported.
Instead change the require of /Users/hermangruber/IdeaProjects/express-example/node_modules/express-request-id/index.js in /Users/hermangruber/IdeaProjects/express-example/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/hermangruber/IdeaProjects/express-example/dist/index.js:8:46) {
code: 'ERR_REQUIRE_ESM'
}
BTW, we tried to work around the issue by converting our app in full to ES2020 modules, but it seems that the rest of the ecosystem is not yet fully migrated to ESM. For example, jest 29.5 has only experimental support for ESM: https://jestjs.io/docs/ecmascript-modules