doc: highlight module loading difference between import and require

PR-URL: https://github.com/nodejs/node/pull/59815
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Ajay A authored and Antoine du Hamel committed 2025-11-10 13:30:10 +01:00
1 parent 212775410b
commit 795f32bf91
1 file changed
+6
+6
View File
@@ -332,6 +332,12 @@ syncBuiltinESMExports();
fs.readFileSync === readFileSync;
```
> When importing built-in modules, all the named exports (i.e. properties of the module exports object)
> are populated even if they are not individually accessed.
> This can make initial imports of built-in modules slightly slower compared to loading them with
> `require()` or `process.getBuiltinModule()`, where the module exports object is evaluated immediately,
> but some of its properties may only be initialized when first accessed individually.
## `import()` expressions
[Dynamic `import()`][] provides an asynchronous way to import modules. It is