diff options
author | Myles Borins <myles.borins@gmail.com> | 2020-04-21 23:35:48 -0400 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2020-04-28 23:00:42 +0100 |
commit | cb4d8ce889b3c5f41d9937a750476a3d983536ec (patch) | |
tree | d6ac977a1a5f5c958a8d1465b88d88fb7c430e69 | |
parent | 8a4de2ef255973660ab4160f6e80df6e9c228a90 (diff) | |
download | node-new-cb4d8ce889b3c5f41d9937a750476a3d983536ec.tar.gz |
module: refactor condition
PR-URL: https://github.com/nodejs/node/pull/32989
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com>
-rw-r--r-- | lib/internal/errors.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 6fa2303490..e9e11bf0fb 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1121,8 +1121,7 @@ E('ERR_INVALID_PACKAGE_TARGET', return `Invalid "exports" main target ${JSONStringify(target)} defined ` + `in the package config ${pkgPath}${sep}package.json${relError ? '; targets must start with "./"' : ''}`; - } else if (typeof target === 'string' && target !== '' && - !StringPrototypeStartsWith(target, './')) { + } else if (relError) { return `Invalid "exports" target ${JSONStringify(target)} defined for '${ StringPrototypeSlice(key, 0, -subpath.length || key.length)}' in the ` + `package config ${pkgPath}${sep}package.json; ` + |