★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/1fd1395ee9Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
lib,doc: revert format name to cjs over commonjs
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 1fd1395ee93690c6a6ba70805ac9401a6a514483
Showing with 3 additions and 3 deletions.
  1. +1 −1 doc/api/esm.md
  2. +1 −1 lib/internal/loader/DefaultResolve.js
  3. +1 −1 lib/internal/loader/Translators.js
@@ -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] |
@@ -44,7 +44,7 @@ const extensionFormatMap = {
'.mjs': 'esm',
'.json': 'json',
'.node': 'addon',
'.js': 'commonjs'
'.js': 'cjs'
};

function resolve(specifier, parentURL) {
@@ -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[

0 comments on commit 1fd1395

Please sign in to comment.