diff --git a/doc/api/esm.md b/doc/api/esm.md index 10f20958593b59..2cfa5a9f29c753 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -137,7 +137,7 @@ module. This can be one of the following: | `format` | Description | | --- | --- | | `"esm"` | Load a standard JavaScript module | -| `"commonjs"` | Load a node-style CommonJS module | +| `"cjs"` | Load a node-style CommonJS module | | `"builtin"` | Load a node builtin CommonJS module | | `"json"` | Load a JSON file | | `"addon"` | Load a [C++ Addon][addons] | diff --git a/lib/internal/loader/DefaultResolve.js b/lib/internal/loader/DefaultResolve.js index faadf0bc99ef95..69dd9537c18c2d 100644 --- a/lib/internal/loader/DefaultResolve.js +++ b/lib/internal/loader/DefaultResolve.js @@ -44,7 +44,7 @@ const extensionFormatMap = { '.mjs': 'esm', '.json': 'json', '.node': 'addon', - '.js': 'commonjs' + '.js': 'cjs' }; function resolve(specifier, parentURL) { diff --git a/lib/internal/loader/Translators.js b/lib/internal/loader/Translators.js index f1db8334dd5eea..d2f28774177fd6 100644 --- a/lib/internal/loader/Translators.js +++ b/lib/internal/loader/Translators.js @@ -32,7 +32,7 @@ translators.set('esm', async (url) => { // Strategy for loading a node-style CommonJS module const isWindows = process.platform === 'win32'; const winSepRegEx = /\//g; -translators.set('commonjs', async (url) => { +translators.set('cjs', async (url) => { debug(`Translating CJSModule ${url}`); const pathname = internalURLModule.getPathFromURL(new URL(url)); const module = CJSModule._cache[