Skip to content

Commit

Permalink
lib,doc: revert format name to cjs over commonjs
Browse files Browse the repository at this point in the history
PR-URL: #18596
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
guybedford authored and MylesBorins committed Feb 20, 2018
1 parent afc87c2 commit 1fd1395
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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] |
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/loader/DefaultResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const extensionFormatMap = {
'.mjs': 'esm',
'.json': 'json',
'.node': 'addon',
'.js': 'commonjs'
'.js': 'cjs'
};

function resolve(specifier, parentURL) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/loader/Translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand Down

0 comments on commit 1fd1395

Please sign in to comment.