mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
doc: fix ESM/CJS wrapper example
PR-URL: https://github.com/nodejs/node/pull/34853 Refs: https://github.com/nodejs/node/issues/34714 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
3ea7e03ae4
commit
da150f4e1e
1 file changed
+6
@@ -637,6 +637,12 @@ CommonJS entry point for `require`.
|
||||
}
|
||||
```
|
||||
|
||||
The above example uses explicit extensions `.mjs` and `.cjs`.
|
||||
If your files use the `.js` extension, `"type": "module"` will cause such files
|
||||
to be treated as ES modules, just as `"type": "commonjs"` would cause them
|
||||
to be treated as CommonJS.
|
||||
See [Enabling](#esm_enabling).
|
||||
|
||||
```js
|
||||
// ./node_modules/pkg/index.cjs
|
||||
exports.name = 'value';
|
||||
|
||||
Reference in new issue
Block a user