Skip to content

Commit

Permalink
[Fix] make /node_modules/ check work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bgotink committed Sep 3, 2020
1 parent ee08e7c commit 65d88f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resolve-exports.js
Expand Up @@ -58,7 +58,7 @@ if (typeof String.prototype.startsWith === 'function') {
function resolveExportsTarget(packagePath, parent, key, target, subpath, env) {
if (typeof target === 'string') {
var resolvedTarget = path.resolve(packagePath, target);
if (!(/^\.\//).test(target) || resolvedTarget.indexOf('/node_modules/', packagePath.length - 1) !== -1 || !startsWith(resolvedTarget, packagePath)) {
if (!(/^\.\//).test(target) || resolvedTarget.indexOf(path.sep + 'node_modules' + path.sep, packagePath.length - 1) !== -1 || !startsWith(resolvedTarget, packagePath)) {
throw makeError('ERR_INVALID_PACKAGE_TARGET', 'Invalid "exports" target ' + JSON.stringify(target)
+ ' defined for ' + key + ' in ' + packagePath + path.sep + 'package.json imported from ' + parent + '.');
}
Expand Down

0 comments on commit 65d88f3

Please sign in to comment.