Skip to content

Conversation

@joyeecheung
Copy link
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.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Oct 21, 2025
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 through
  `module.registerHooks()`, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants