Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2020-09-09 18:24:18 +0300
committerRich Trott <rtrott@gmail.com>2020-09-12 02:26:00 +0300
commitf54254afedd5a2b4800854e7766d845e3803bef6 (patch)
tree66a1133384a2aa95e35bcaf58e5fa89ffe15ce15 /lib/internal/errors.js
parent91272bce7a5c98829f4a2736def1d684c8f8eb1b (diff)
errors: simplify ERR_REQUIRE_ESM message generation
Because of the condition that starts the `if` block, we know that `parentPath` must be truthy. So there is no need to check for that in the template string that generates the error message. PR-URL: https://github.com/nodejs/node/pull/35123 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
Diffstat (limited to 'lib/internal/errors.js')
-rw-r--r--lib/internal/errors.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 1c2ef24369b..787298288b6 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -1317,7 +1317,7 @@ E('ERR_REQUIRE_ESM',
filename : path.basename(filename);
msg +=
'\nrequire() of ES modules is not supported.\nrequire() of ' +
- `${filename} ${parentPath ? `from ${parentPath} ` : ''}` +
+ `${filename} from ${parentPath} ` +
'is an ES module file as it is a .js file whose nearest parent ' +
'package.json contains "type": "module" which defines all .js ' +
'files in that package scope as ES modules.\nInstead rename ' +