Skip to content

Commit 4b3b0e3

Browse files
fox1tBethGriggs
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 d6bb2ad commit 4b3b0e3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/esm.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,12 @@ CommonJS entry point for `require`.
689689
}
690690
```
691691

692+
The above example uses explicit extensions `.mjs` and `.cjs`.
693+
If your files use the `.js` extension, `"type": "module"` will cause such files
694+
to be treated as ES modules, just as `"type": "commonjs"` would cause them
695+
to be treated as CommonJS.
696+
See [Enabling](#esm_enabling).
697+
692698
```js
693699
// ./node_modules/pkg/index.cjs
694700
exports.name = 'value';

0 commit comments

Comments
 (0)