Skip to content

module: add test for cjs loader with esm flag

Rodrigo Muino Tomonari requested to merge github/fork/aduh95/fix-esm-load into master

When using the --experimental-modules flag with node, the CJS loader crashes sometime aas described in the related issue. I don' t have sufficient background to understand the module loading, but I have managed to isolate the bug and right a test, hoping that would encourages someone with a better background to tackle the issue.

I have observed the bug to be triggered by stealthy-require module, but only when the --experimental-modules flag is specified, even if no .mjs are imported. This is going to be a problem when we remove the esm flag as the module has more than 4M weekly download on npm.

Refs: https://github.com/nodejs/node/issues/25482

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading