@@ -171,8 +171,9 @@ module.exports = function resolve(x, options, callback) {
171
171
}
172
172
if ( ( / [ / \\ ] n o d e _ m o d u l e s [ / \\ ] * $ / ) . test ( dir ) ) return cb ( null ) ;
173
173
174
- maybeUnwrapSymlink ( path . join ( dir , 'package.json' ) , opts , function ( unwrapErr , pkgfile ) {
174
+ maybeUnwrapSymlink ( dir , opts , function ( unwrapErr , pkgdir ) {
175
175
if ( unwrapErr ) return loadpkg ( path . dirname ( dir ) , cb ) ;
176
+ var pkgfile = path . join ( pkgdir , 'package.json' ) ;
176
177
isFile ( pkgfile , function ( err , ex ) {
177
178
// on err, ex is false
178
179
if ( ! ex ) return loadpkg ( path . dirname ( dir ) , cb ) ;
@@ -198,8 +199,9 @@ module.exports = function resolve(x, options, callback) {
198
199
fpkg = opts . package ;
199
200
}
200
201
201
- maybeUnwrapSymlink ( path . join ( x , 'package.json' ) , opts , function ( unwrapErr , pkgfile ) {
202
+ maybeUnwrapSymlink ( x , opts , function ( unwrapErr , pkgdir ) {
202
203
if ( unwrapErr ) return cb ( unwrapErr ) ;
204
+ var pkgfile = path . join ( pkgdir , 'package.json' ) ;
203
205
isFile ( pkgfile , function ( err , ex ) {
204
206
if ( err ) return cb ( err ) ;
205
207
if ( ! ex ) return loadAsFile ( path . join ( x , 'index' ) , fpkg , cb ) ;
0 commit comments