@@ -842,12 +842,12 @@ function syncPreinstallStateWithDisk(locationTree: LocationTree, binSymlinks: Bi
842
842
const locatorLocations = new Map ( ) ;
843
843
let installChangedByUser = false ;
844
844
845
- const syncNodeWithDisk = ( parentPath : PortablePath , entry : Filename , parentNode : LocationNode , refinedNode : LocationNode , nodeModulesDiskEntries : Set < Filename > ) => {
845
+ const syncNodeWithDisk = ( parentPath : PortablePath , entry : Filename , parentNode : LocationNode , refinedNode : LocationNode , parentDiskEntries : Set < Filename > ) => {
846
846
let doesExistOnDisk = true ;
847
847
const entryPath = ppath . join ( parentPath , entry ) ;
848
- let childNodeModulesDiskEntries = new Set < Filename > ( ) ;
848
+ let childDiskEntries = new Set < Filename > ( ) ;
849
849
850
- if ( entry === NODE_MODULES ) {
850
+ if ( entry === NODE_MODULES || entry . startsWith ( `@` ) ) {
851
851
let stats ;
852
852
try {
853
853
stats = xfs . statSync ( entryPath ) ;
@@ -860,9 +860,9 @@ function syncPreinstallStateWithDisk(locationTree: LocationTree, binSymlinks: Bi
860
860
installChangedByUser = true ;
861
861
} else if ( stats . mtimeMs > stateMtimeMs ) {
862
862
installChangedByUser = true ;
863
- childNodeModulesDiskEntries = new Set ( xfs . readdirSync ( entryPath ) ) ;
863
+ childDiskEntries = new Set ( xfs . readdirSync ( entryPath ) ) ;
864
864
} else {
865
- childNodeModulesDiskEntries = new Set ( parentNode . children . get ( NODE_MODULES ) ! . children . keys ( ) ) ;
865
+ childDiskEntries = new Set ( parentNode . children . get ( entry ) ! . children . keys ( ) ) ;
866
866
}
867
867
868
868
const binarySymlinks = binSymlinks . get ( parentPath ) ;
@@ -893,7 +893,7 @@ function syncPreinstallStateWithDisk(locationTree: LocationTree, binSymlinks: Bi
893
893
}
894
894
}
895
895
} else {
896
- doesExistOnDisk = nodeModulesDiskEntries . has ( entry ) ;
896
+ doesExistOnDisk = parentDiskEntries . has ( entry ) ;
897
897
}
898
898
899
899
const node = parentNode . children . get ( entry ) ! ;
@@ -908,7 +908,7 @@ function syncPreinstallStateWithDisk(locationTree: LocationTree, binSymlinks: Bi
908
908
}
909
909
910
910
for ( const childEntry of node . children . keys ( ) ) {
911
- syncNodeWithDisk ( entryPath , childEntry , node , childRefinedNode , childNodeModulesDiskEntries ) ;
911
+ syncNodeWithDisk ( entryPath , childEntry , node , childRefinedNode , childDiskEntries ) ;
912
912
}
913
913
} else if ( node . locator ) {
914
914
project . storedBuildState . delete ( structUtils . parseLocator ( node . locator ) . locatorHash ) ;
0 commit comments