diff options
Diffstat (limited to 'ext/node/package_json.rs')
-rw-r--r-- | ext/node/package_json.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/node/package_json.rs b/ext/node/package_json.rs index 7fcfb6917..9d6a491b5 100644 --- a/ext/node/package_json.rs +++ b/ext/node/package_json.rs @@ -93,10 +93,6 @@ impl PackageJson { ), }; - if source.trim().is_empty() { - return Ok(PackageJson::empty(path)); - } - let package_json = Self::load_from_string(path, source)?; CACHE.with(|cache| { cache @@ -110,6 +106,10 @@ impl PackageJson { path: PathBuf, source: String, ) -> Result<PackageJson, AnyError> { + if source.trim().is_empty() { + return Ok(PackageJson::empty(path)); + } + let package_json: Value = serde_json::from_str(&source).map_err(|err| { anyhow::anyhow!( "malformed package.json: {}\n at {}", |