Skip to content

Commit 18f6f8e

Browse files
committed
docs: add review suggestions to require()
1 parent b4e979f commit 18f6f8e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

doc/api/modules.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,18 @@ added: v0.1.13
552552

553553
* {Function}
554554

555-
To require modules.
555+
Used to import modules, `JSON` and local files. Modules can be imported from `node_modules`. Local modules and JSON files can be imported using the pattern `'./'`.
556+
557+
```js
558+
// importing localModule
559+
const myLocalModule = require('./path/myLocalModule');
560+
561+
// importing JSON file
562+
const jsonData = require('./path/filename.json');
563+
564+
// importing module from node_modules or Node.js internals
565+
const crypto = require('crypto');
566+
```
556567

557568
#### require.cache
558569
<!-- YAML

0 commit comments

Comments
 (0)