diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-01-06 12:57:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 12:57:52 -0500 |
commit | d1cdf65b106e1bcb3a2b324c013f908c12d6368f (patch) | |
tree | 7c974a262b5da9e3cb7d3835a4252d72deb70ac2 /ext/node | |
parent | 7db729a42dca760e1024f296ba4b9e5982f25325 (diff) |
fix(npm): handle declaration file resolution where packages incorrectly define "types" last in "exports" (#17290)
Closes #17279
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/resolution.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs index 95099d14e..7500f0f31 100644 --- a/ext/node/resolution.rs +++ b/ext/node/resolution.rs @@ -445,7 +445,13 @@ fn resolve_package_target( mode, npm_resolver, ) - .map(Some); + .map(|path| { + if mode.is_types() { + path_to_declaration_path(path, referrer_kind) + } else { + Some(path) + } + }); } else if let Some(target_arr) = target.as_array() { if target_arr.is_empty() { return Ok(None); |