Skip to content

Commit 57bbbea

Browse files
committed
[Fix] make /node_modules/ check work on windows
1 parent ee08e7c commit 57bbbea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/resolve-exports.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if (typeof String.prototype.startsWith === 'function') {
5858
function resolveExportsTarget(packagePath, parent, key, target, subpath, env) {
5959
if (typeof target === 'string') {
6060
var resolvedTarget = path.resolve(packagePath, target);
61-
if (!(/^\.\//).test(target) || resolvedTarget.indexOf('/node_modules/', packagePath.length - 1) !== -1 || !startsWith(resolvedTarget, packagePath)) {
61+
if (!(/^\.\//).test(target) || target.indexOf(path.sep + 'node_modules' + path.sep, packagePath.length - 1) !== -1 || !startsWith(resolvedTarget, packagePath)) {
6262
throw makeError('ERR_INVALID_PACKAGE_TARGET', 'Invalid "exports" target ' + JSON.stringify(target)
6363
+ ' defined for ' + key + ' in ' + packagePath + path.sep + 'package.json imported from ' + parent + '.');
6464
}

0 commit comments

Comments
 (0)