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 2, 2020
1 parent ee08e7c commit 57bbbea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resolve-exports.js
Original file line number Diff line number Diff line change
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) || target.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 57bbbea

Please sign in to comment.