diff options
author | Myles Borins <myles.borins@gmail.com> | 2020-04-21 23:35:48 -0400 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2020-04-28 13:58:30 +0200 |
commit | c97a7ce39cee43886f35918058767846bf8eecb0 (patch) | |
tree | 063fd44686aa668eea76f73f40468196d0c69cf8 | |
parent | 79d92b293119341b6567326f5013a4b76e763a5f (diff) | |
download | node-new-c97a7ce39cee43886f35918058767846bf8eecb0.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 f7f027851b..222ca0c0ad 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1117,8 +1117,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; ` + |