GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: highlight module loading difference between import and require · nodejs/node@795f32b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • esm.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/esm.md‎

Copy file name to clipboardExpand all lines: doc/api/esm.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ syncBuiltinESMExports();
332332
fs.readFileSync === readFileSync;
333333
```
334334

335+
> When importing built-in modules, all the named exports (i.e. properties of the module exports object)
336+
> are populated even if they are not individually accessed.
337+
> This can make initial imports of built-in modules slightly slower compared to loading them with
338+
> `require()` or `process.getBuiltinModule()`, where the module exports object is evaluated immediately,
339+
> but some of its properties may only be initialized when first accessed individually.
340+
335341
## `import()` expressions
336342

337343
[Dynamic `import()`][] provides an asynchronous way to import modules. It is

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.