Skip to content

Commit

Permalink
parse path correclty, using an ugly trick
Browse files Browse the repository at this point in the history
  • Loading branch information
clement committed Aug 28, 2020
1 parent 25bc50c commit e2dde58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ function installShims ({ modules, overwrite }, done) {
}

parallel(shimPkgNames.map(function (name) {
var modPath = require.resolve(name, { paths: [path.join(__dirname.split('node_modules')[0], 'node_modules')] })
var opts = { paths: [path.join(__dirname.split('node_modules')[0], 'node_modules')] }
var modPath
if (require.resolve(name, opts).includes('.')) {
modPath = require.resolve(name + '/package.json', opts)
modPath = modPath.substring(0, modPath.length - 13)
} else {
modPath = require.resolve(name, opts)
}
return function (cb) {
fs.exists(modPath, function (exists) {
if (!exists) return cb()
Expand Down

0 comments on commit e2dde58

Please sign in to comment.