diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-09-12 15:47:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 15:47:54 -0400 |
commit | 98454c1eb802b91a8c77dd97888a8994c85dfa46 (patch) | |
tree | 851f7590f14a2f54db5ef306e884cc2c64bf6f07 /ext/node/lib.rs | |
parent | a3a4760831e14307a9499d4e410cf1653b416dc1 (diff) |
fix(npm): support cjs resolution of package subpath with package.json (#15855)
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r-- | ext/node/lib.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs index 753a11b5d..db4fe3178 100644 --- a/ext/node/lib.rs +++ b/ext/node/lib.rs @@ -604,15 +604,12 @@ where #[op] fn op_require_read_package_scope( state: &mut OpState, - filename: String, + package_json_path: String, ) -> Option<PackageJson> { check_unstable(state); let resolver = state.borrow::<Rc<dyn DenoDirNpmResolver>>().clone(); - resolution::get_package_scope_config( - &Url::from_file_path(filename).unwrap(), - &*resolver, - ) - .ok() + let package_json_path = PathBuf::from(package_json_path); + PackageJson::load(&*resolver, package_json_path).ok() } #[op] |