Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Sinik <maksim@sinik.it>2020-08-20 16:44:38 +0300
committerRich Trott <rtrott@gmail.com>2020-08-22 19:22:03 +0300
commitac3049d3312732da97a80f7db9572e846e13b7ee (patch)
tree14e85ac5ae9ecde5ccfb60e7aa3cfaa0043cc6a0 /doc/api/esm.md
parent44e6a6af67fe5038540af73f5e3456bc29243550 (diff)
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>
Diffstat (limited to 'doc/api/esm.md')
-rw-r--r--doc/api/esm.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/api/esm.md b/doc/api/esm.md
index 18efdb3c8b7..2c860c710c6 100644
--- a/doc/api/esm.md
+++ b/doc/api/esm.md
@@ -689,6 +689,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';