Skip to content

BREAKING: deprecate loading files with unknown or missing extensions

This prevents treating files as CJS when they are not specified as .js explicitly. Package managers create links without the extension already so the use of "bin" still works. Also, node continues to do path searching and can find a .js file with the same location via command line.

This fixes some problems with ESM loading from CLI arguments since we cannot reliably know if a file is supposed to be loaded via CJS normally. This will also be desired once loader hooks come around so that they can capture all modules loaded via CLI arguments.

Right now we have a very simplistic check for if a main entry point should be loaded as ESM. However, this still has collisions and doesn't have a path forward for loader hooks wishing to change how main entry points/preloading via --require works.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

module

Merge request reports

Loading