ESM issue on ../node_modules/codeceptjs/lib/config.js


Context: Our current setup involves utilizing a proprietary API to establish preconditions, which is implemented as an ECMAScript module (ESM). Additionally, we have recently upgraded node-fetch to version 3.

We attempted to transition our end-to-end (E2E) tests to utilize the “module” format instead of “CommonJS”, but encountered an issue in the process.

Can someone help me how am I able to manage to fix this?

“Must use import to load ES Module: …/{file.ts}
require() of ES modules is not supported.
require() of …/{file.ts} from …node_modules\codeceptjs\lib\config.js is an ES module file as it is a .ts file whose nearest parent package.json contains “type”: “module” which defines all .ts files in that package scope as ES modules.”

…node_modules\codeceptjs\lib\config.js - This was automatically generated, and we are unsure whether CodeceptJS already supports this change.

Appreciate the help!