Skip to content

Commit 500b737

Browse files
fox1taddaleax
authored andcommitted
doc: fix ESM/CJS wrapper example
PR-URL: #34853 Refs: #34714 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent eb95c6a commit 500b737

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/esm.md

+6
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,12 @@ CommonJS entry point for `require`.
637637
}
638638
```
639639

640+
The above example uses explicit extensions `.mjs` and `.cjs`.
641+
If your files use the `.js` extension, `"type": "module"` will cause such files
642+
to be treated as ES modules, just as `"type": "commonjs"` would cause them
643+
to be treated as CommonJS.
644+
See [Enabling](#esm_enabling).
645+
640646
```js
641647
// ./node_modules/pkg/index.cjs
642648
exports.name = 'value';

0 commit comments

Comments
 (0)