@@ -614,9 +614,12 @@ export default class Manager {
614614 delete this . cachedPaths [ dirredPath ] [ path ] ;
615615 }
616616
617- let connectedPath = / ^ ( \w | @ \w ) / . test ( shimmedPath )
618- ? pathUtils . join ( '/node_modules' , shimmedPath )
619- : pathUtils . join ( pathUtils . dirname ( currentPath ) , shimmedPath ) ;
617+ let connectedPath = shimmedPath ;
618+ if ( connectedPath . indexOf ( '/node_modules' ) !== 0 ) {
619+ connectedPath = / ^ ( \w | @ \w ) / . test ( shimmedPath )
620+ ? pathUtils . join ( '/node_modules' , shimmedPath )
621+ : pathUtils . join ( pathUtils . dirname ( currentPath ) , shimmedPath ) ;
622+ }
620623
621624 const isDependency = connectedPath . includes ( '/node_modules/' ) ;
622625
@@ -694,16 +697,20 @@ export default class Manager {
694697 throw new Error ( `Could not find '${ resolvedPath } ' in local files.` ) ;
695698 }
696699 } catch ( e ) {
700+ // MAKE SURE TO SYNC THIS WITH ASYNC VERSION
697701 if (
698702 this . cachedPaths [ dirredPath ] &&
699703 this . cachedPaths [ dirredPath ] [ path ]
700704 ) {
701705 delete this . cachedPaths [ dirredPath ] [ path ] ;
702706 }
703707
704- let connectedPath = / ^ ( \w | @ \w ) / . test ( shimmedPath )
705- ? pathUtils . join ( '/node_modules' , shimmedPath )
706- : pathUtils . join ( pathUtils . dirname ( currentPath ) , shimmedPath ) ;
708+ let connectedPath = shimmedPath ;
709+ if ( connectedPath . indexOf ( '/node_modules' ) !== 0 ) {
710+ connectedPath = / ^ ( \w| @\w) / . test ( shimmedPath )
711+ ? pathUtils . join ( '/node_modules' , shimmedPath )
712+ : pathUtils . join ( pathUtils . dirname ( currentPath ) , shimmedPath ) ;
713+ }
707714
708715 const isDependency = connectedPath . includes ( '/node_modules/' ) ;
709716
0 commit comments