Skip to content

Commit b10e129

Browse files
fixup! doc: correct module loading descriptions
Co-authored-by: Jacob Smith <[email protected]>
1 parent b79756e commit b10e129

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

doc/api/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ directory. That entry point string is then resolved as if it's been requested
2929
by `require()` from the current working directory. If no corresponding file
3030
is found, an error is thrown.
3131

32-
The resolved path is usually also loaded as if it's been requested by `require()`,
33-
unless one of the conditions below apply, then it's loaded as if it's been requested
32+
By default, the resolved path is also loaded as if it's been requested by `require()`,
33+
unless one of the conditions below applythen it's loaded as if it's been requested
3434
by `import()`:
3535

3636
* The program was started with a command-line flag that forces the entry

doc/api/packages.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ When a module is requested via `require()`:
161161
* Files with any other extension, or without extensions, are treated as JavaScript
162162
text files.
163163
* `require()` can only be used to [load ECMAScript modules from CommonJS modules][] if
164-
the [ECMAScript module][ES Module] and its dependencies are synchronous
164+
the [ECMAScript module][ES Module] _and its dependencies_ are synchronous
165165
(i.e. they do not contain top-level `await`).
166166

167167
When a module is requested via `import` statements or `import()` expressions:
@@ -183,12 +183,13 @@ When a module is requested via `import` statements or `import()` expressions:
183183
files.
184184
* `.wasm` files are treated as [WebAssembly modules][].
185185
* Any other file extensions will result in a [`ERR_UNKNOWN_FILE_EXTENSION`][] error.
186+
Additional file extensions can be facilitated via [customization hooks][].
186187
* `import`/`import()` can be used to load JavaScript [CommonJS modules][commonjs].
187188
Such modules are passed through the `cjs-module-lexer` to try to identify named
188189
exports, which are available if they can be determined through static analysis.
189190

190191
Regardless of how a module is requested, the resolution and loading process can be customized
191-
using [loader hooks][].
192+
using [customization hooks][].
192193

193194
### `package.json` and file extensions
194195

@@ -1176,7 +1177,7 @@ This field defines [subpath imports][] for the current package.
11761177
[folders as modules]: modules.md#folders-as-modules
11771178
[import maps]: https://github.com/WICG/import-maps
11781179
[load ECMAScript modules from CommonJS modules]: modules.md#loading-ecmascript-modules-using-require
1179-
[loader hooks]: module.md#customization-hooks
1180+
[customization hooks]: module.md#customization-hooks
11801181
[packages folder mapping]: https://github.com/WICG/import-maps#packages-via-trailing-slashes
11811182
[self-reference]: #self-referencing-a-package-using-its-name
11821183
[subpath exports]: #subpath-exports

0 commit comments

Comments
 (0)