Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ changes:
Type: Documentation-only

The [`require.extensions`][] property is deprecated.
Use [`module.registerHooks()`][] to customize module loading instead.

### DEP0040: `node:punycode` module

Expand Down
9 changes: 5 additions & 4 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -946,10 +946,9 @@ Process files with the extension `.sjs` as `.js`:
require.extensions['.sjs'] = require.extensions['.js'];
```

**Deprecated.** In the past, this list has been used to load non-JavaScript
modules into Node.js by compiling them on-demand. However, in practice, there
are much better ways to do this, such as loading modules via some other Node.js
program, or compiling them to JavaScript ahead of time.
**Deprecated.** Use [`module.registerHooks()`][] to customize module loading
instead. Its [synchronous customization hooks][] support both `require()` and
`import`. Alternatively, compile non-JavaScript modules to JavaScript ahead of time.

Avoid using `require.extensions`. Use could cause subtle bugs and resolving the
extensions gets slower with each registered extension.
Expand Down Expand Up @@ -1299,6 +1298,7 @@ This section was moved to
[`module.builtinModules`]: module.md#modulebuiltinmodules
[`module.children`]: #modulechildren
[`module.id`]: #moduleid
[`module.registerHooks()`]: module.md#moduleregisterhooksoptions
[`module` core module]: module.md
[`module` object]: #the-module-object
[`node:ffi`]: ffi.md
Expand All @@ -1316,3 +1316,4 @@ This section was moved to
[native addons]: addons.md
[subpath exports]: packages.md#subpath-exports
[subpath imports]: packages.md#subpath-imports
[synchronous customization hooks]: module.md#synchronous-customization-hooks
Loading