Skip to content

Commit 295771c

Browse files
committed
fixup! fixup! doc: correct module loading descriptions
1 parent b10e129 commit 295771c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/api/packages.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ CommonJS. This includes the following:
146146

147147
Node.js has two types of module resolution and loading, chosen based on how the module is requested.
148148

149-
When a module is requested via `require()`:
149+
When a module is requested via `require()` (available by default in CommonJS modules,
150+
and can be dynamically generated using `createRequire()` in both CommonJS and ES Modules):
150151

151152
* Resolution:
152153
* The resolution initiated by `require()` supports [folders as modules][].
@@ -164,7 +165,8 @@ When a module is requested via `require()`:
164165
the [ECMAScript module][ES Module] _and its dependencies_ are synchronous
165166
(i.e. they do not contain top-level `await`).
166167

167-
When a module is requested via `import` statements or `import()` expressions:
168+
When a module is requested via static `import` statements (only available in ES Modules)
169+
or `import()` expressions (available in both CommonJS and ES Modules):
168170

169171
* Resolution:
170172
* The resolution of `import`/`import()` does not support folders as modules,
@@ -1173,11 +1175,11 @@ This field defines [subpath imports][] for the current package.
11731175
[`ERR_PACKAGE_PATH_NOT_EXPORTED`]: errors.md#err_package_path_not_exported
11741176
[`ERR_UNKNOWN_FILE_EXTENSION`]: errors.md#err_unknown_file_extension
11751177
[`package.json`]: #nodejs-packagejson-field-definitions
1178+
[customization hooks]: module.md#customization-hooks
11761179
[entry points]: #package-entry-points
11771180
[folders as modules]: modules.md#folders-as-modules
11781181
[import maps]: https://github.com/WICG/import-maps
11791182
[load ECMAScript modules from CommonJS modules]: modules.md#loading-ecmascript-modules-using-require
1180-
[customization hooks]: module.md#customization-hooks
11811183
[packages folder mapping]: https://github.com/WICG/import-maps#packages-via-trailing-slashes
11821184
[self-reference]: #self-referencing-a-package-using-its-name
11831185
[subpath exports]: #subpath-exports

0 commit comments

Comments
 (0)