summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.js1
-rw-r--r--doc/api/modules.md8
2 files changed, 5 insertions, 4 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index ff117624f5..55b61cea63 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -39,6 +39,7 @@ module.exports = {
{
files: [
'doc/api/esm.md',
+ 'doc/api/modules.md',
'test/es-module/test-esm-type-flag.js',
'test/es-module/test-esm-type-flag-alias.js',
'*.mjs',
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 9266d43f49..2be27fe6ce 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -923,11 +923,11 @@ added: v12.2.0
* Returns: {require} Require function
```js
-const { createRequire } = require('module');
-const requireUtil = createRequire(require.resolve('../src/utils/'));
+import { createRequire } from 'module';
+const require = createRequire(import.meta.url);
-// Require `../src/utils/some-tool`
-requireUtil('./some-tool');
+// sibling-module.js is a CommonJS module.
+const siblingModule = require('./sibling-module');
```
### module.createRequireFromPath(filename)