File tree Expand file tree Collapse file tree
packages/nx/src/lock-file Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -580,10 +580,20 @@ function elevateNestedPaths(
580580 `${ segs . join ( '/node_modules/' ) } /node_modules/${ packageName } ` ;
581581
582582 // check if grandparent has the same package
583- while (
584- segments . length > 1 &&
585- ! result . has ( getNewPath ( segments . slice ( 0 , - 1 ) ) )
586- ) {
583+ const shouldElevate = ( segs : string [ ] ) => {
584+ const newPath = getNewPath ( segs . slice ( 0 , - 1 ) ) ;
585+ if ( result . has ( newPath ) ) {
586+ const match = result . get ( newPath ) ;
587+ const source = remappedPackages . get ( path ) ;
588+ return (
589+ match . valueV1 ?. version === source . valueV1 ?. version &&
590+ match . valueV3 ?. version === source . valueV3 ?. version
591+ ) ;
592+ }
593+ return true ;
594+ } ;
595+
596+ while ( segments . length > 1 && shouldElevate ( segments ) ) {
587597 segments . pop ( ) ;
588598 }
589599 const newPath = getNewPath ( segments ) ;
You can’t perform that action at this time.
0 commit comments