node icon indicating copy to clipboard operation
node copied to clipboard

ERR_INTERNAL_ASSERTION thrown when using --experimental-require-module and --import together

Open kylesmile opened this issue 6 months ago • 6 comments

Version

v22.7.0

Platform

Darwin Kyles-MBP-2.home 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

With two files test.mjs and test.cjs (both files can be empty):

node --experimental-require-module --import=./test.mjs test.cjs

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

No error should be thrown, and --experimental-require-module and --import can be used in combination. For example, to use module customization hooks when ECMAScript and CommonJS module types need to be mixed.

What do you see instead?

This error is thrown:

node:internal/assert:14
    throw new ERR_INTERNAL_ASSERTION(message);
          ^

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at assert (node:internal/assert:14:11)
    at ModuleLoader.requireCommonJS (node:internal/modules/esm/translators:316:3)
    at callTranslator (node:internal/modules/esm/loader:428:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:434:30)
    at async link (node:internal/modules/esm/module_job:87:21) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Additional information

No response

kylesmile avatar Aug 26 '24 21:08 kylesmile