From c66777b5d3200ef5d4bf3893fd02f8a2014e8dd5 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 27 Mar 2022 11:18:20 +0200 Subject: [PATCH 1/3] doc: add introduction sentence for CJS --- doc/api/modules.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index de17eea503cb5c..d5f96aaa0626aa 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -6,7 +6,11 @@ -In the Node.js module system, each file is treated as a separate module. For +CommonJS modules are the classic format to package JavaScript code for reuse. If +you are interested in writing browser-compatible code, check out the +[ECMAScript modules][] documentation. + +In the CommonJS module system, each file is treated as a separate module. For example, consider a file named `foo.js`: ```js From 630148681c55e027ebd01336b2604cb1351b9ac8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 27 Mar 2022 22:41:08 +0200 Subject: [PATCH 2/3] fixup! doc: add introduction sentence for CJS --- doc/api/modules.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index d5f96aaa0626aa..0530a1ea7faaad 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -6,11 +6,9 @@ -CommonJS modules are the classic format to package JavaScript code for reuse. If -you are interested in writing browser-compatible code, check out the -[ECMAScript modules][] documentation. +CommonJS modules are the classic format to package JavaScript code for Node.js. -In the CommonJS module system, each file is treated as a separate module. For +In Node.js, each file is treated as a separate module. For example, consider a file named `foo.js`: ```js From 4932e89ee67f500ee1bd039ab84a2f71c1f6f6a8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 29 Mar 2022 22:34:32 +0200 Subject: [PATCH 3/3] Apply suggestion from code review --- doc/api/modules.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 0530a1ea7faaad..0264c4ff558fe1 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -6,7 +6,9 @@ -CommonJS modules are the classic format to package JavaScript code for Node.js. +CommonJS modules are the original way to package JavaScript code for Node.js. +Node.js also supports the [ECMAScript modules][] standard used by browsers +and other JavaScript runtimes. In Node.js, each file is treated as a separate module. For example, consider a file named `foo.js`: