We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d34c256 commit d7c7023Copy full SHA for d7c7023
doc/api/esm.md
@@ -278,7 +278,16 @@ These CommonJS variables are not available in ES modules.
278
279
`require` can be imported into an ES module using [`module.createRequire()`][].
280
281
-An equivalent for `__filename` and `__dirname` is [`import.meta.url`][].
+An equivalent for variable `__filename` and `__dirname` can be created inside
282
+each file with [`import.meta.url`][].
283
+
284
+```js
285
+import { fileURLToPath } from 'url';
286
+import { dirname } from 'path';
287
288
+const __filename = fileURLToPath(import.meta.url);
289
+const __dirname = dirname(__filename);
290
+```
291
292
### No <code>require.extensions</code>
293
0 commit comments