fix(check): cache bust when changing nodeModulesDir setting (#23355)

This commit is contained in:
David Sherret 2024-04-15 18:58:04 -04:00 committed by GitHub
parent b4257d6990
commit 46c709e52f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -604,6 +604,9 @@ impl CliNpmResolver for ManagedCliNpmResolver {
.collect::<Vec<_>>();
package_reqs.sort_by(|a, b| a.0.cmp(&b.0)); // determinism
let mut hasher = FastInsecureHasher::new();
// ensure the cache gets busted when turning nodeModulesDir on or off
// as this could cause changes in resolution
hasher.write_hashable(self.fs_resolver.node_modules_path().is_some());
for (pkg_req, pkg_nv) in package_reqs {
hasher.write_hashable(&pkg_req);
hasher.write_hashable(&pkg_nv);