Skip to content

BREAKING: deprecate loading files with unknown or missing extensions#15365

Closed
bmeck wants to merge 4 commits intonodejs:masterfrom
bmeck:deprecate-no-extension
Closed

BREAKING: deprecate loading files with unknown or missing extensions#15365
bmeck wants to merge 4 commits intonodejs:masterfrom
bmeck:deprecate-no-extension

Conversation

@bmeck
Copy link
Member

@bmeck bmeck commented Sep 12, 2017

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

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module Issues and PRs related to the module subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.