Skip to content

Commit 1fd1395

Browse files
guybedfordMylesBorins
authored andcommitted
lib,doc: revert format name to cjs over commonjs
PR-URL: #18596 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent afc87c2 commit 1fd1395

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

doc/api/esm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ module. This can be one of the following:
133133
| `format` | Description |
134134
| --- | --- |
135135
| `"esm"` | Load a standard JavaScript module |
136-
| `"commonjs"` | Load a node-style CommonJS module |
136+
| `"cjs"` | Load a node-style CommonJS module |
137137
| `"builtin"` | Load a node builtin CommonJS module |
138138
| `"json"` | Load a JSON file |
139139
| `"addon"` | Load a [C++ Addon][addons] |

lib/internal/loader/DefaultResolve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const extensionFormatMap = {
4444
'.mjs': 'esm',
4545
'.json': 'json',
4646
'.node': 'addon',
47-
'.js': 'commonjs'
47+
'.js': 'cjs'
4848
};
4949

5050
function resolve(specifier, parentURL) {

lib/internal/loader/Translators.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ translators.set('esm', async (url) => {
3232
// Strategy for loading a node-style CommonJS module
3333
const isWindows = process.platform === 'win32';
3434
const winSepRegEx = /\//g;
35-
translators.set('commonjs', async (url) => {
35+
translators.set('cjs', async (url) => {
3636
debug(`Translating CJSModule ${url}`);
3737
const pathname = internalURLModule.getPathFromURL(new URL(url));
3838
const module = CJSModule._cache[

0 commit comments

Comments
 (0)