Skip to content

doc: correct module loading descriptions#60346

Merged
nodejs-github-bot merged 3 commits intonodejs:mainfrom
joyeecheung:fix-package-loader
Oct 31, 2025
Merged

doc: correct module loading descriptions#60346
nodejs-github-bot merged 3 commits intonodejs:mainfrom
joyeecheung:fix-package-loader

Conversation

@joyeecheung
Copy link
Copy Markdown
Member

The existing description is outdated, and exposes too many details that are subject to change.

  • There is no point conceptualizing "two module loaders", in reality the boundary is blurred since the two invoke each other to support require(esm) and import(cjs). The distinction lies not in what kind of module is being requested/which loader is used, but only in how the the module request is initiated (via require() or import()). The inner working of the loaders are subject to change and not suitable to be documented.
  • It should not mention monkey patching in the documentation, as publicly supported universal hooks are already provided, and so there's no need to single out any of them in terms of loader hooks support either.
  • Remove the description about whether they are asynchronous or synchronous, which is also implementation detail subject to change.
  • Add missing descriptions about how .ts, .mts and .cts are treated, and .node is also supported in import now.
  • There is no need to specially mention .node treatment in cli.md, link to the explanations about loading from import in packages.md instead.

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

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants