summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/node/package_json.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/node/package_json.rs b/ext/node/package_json.rs
index 0f7cc5bb1..b24bfdef3 100644
--- a/ext/node/package_json.rs
+++ b/ext/node/package_json.rs
@@ -97,7 +97,13 @@ impl PackageJson {
return Ok(PackageJson::empty(path));
}
- Self::load_from_string(path, source)
+ let package_json = Self::load_from_string(path, source)?;
+ CACHE.with(|cache| {
+ cache
+ .borrow_mut()
+ .insert(package_json.path.clone(), package_json.clone());
+ });
+ Ok(package_json)
}
pub fn load_from_string(
@@ -199,11 +205,6 @@ impl PackageJson {
scripts,
};
- CACHE.with(|cache| {
- cache
- .borrow_mut()
- .insert(package_json.path.clone(), package_json.clone());
- });
Ok(package_json)
}