Skip to content

Commit

Permalink
fix: respect package.exports when resolving SSR deep imports
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed May 31, 2022
1 parent f2c869d commit ac8c233
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -636,8 +636,14 @@ export function tryNodeResolve(
return resolved
}
const resolvedExt = path.extname(resolved.id)
const resolvedId =
isDeepImport && path.extname(id) !== resolvedExt ? id + resolvedExt : id
let resolvedId = id
if (
isDeepImport &&
!pkg?.data.exports &&
path.extname(id) !== resolvedExt
) {
resolvedId += resolvedExt
}
return { ...resolved, id: resolvedId, external: true }
}

Expand Down

0 comments on commit ac8c233

Please sign in to comment.