mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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:
1 parent
212775410b
commit
795f32bf91
1 file changed
+6
@@ -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
|
||||
|
||||
Reference in new issue
Block a user