Skip to content

Commit

Permalink
fix(resolve): deep import resolvedId error (#13010)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Apr 26, 2023
1 parent 08c1452 commit 30a41ff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -773,8 +773,15 @@ export function tryNodeResolve(
}
let resolvedId = id
if (deepMatch && !pkg?.data.exports && path.extname(id) !== resolvedExt) {
resolvedId = resolved.id.slice(resolved.id.indexOf(id))
debug?.(`[processResult] ${colors.cyan(id)} -> ${colors.dim(resolvedId)}`)
// id date-fns/locale
// resolve.id ...date-fns/esm/locale/index.js
const index = resolved.id.indexOf(id)
if (index > -1) {
resolvedId = resolved.id.slice(index)
debug?.(
`[processResult] ${colors.cyan(id)} -> ${colors.dim(resolvedId)}`,
)
}
}
return { ...resolved, id: resolvedId, external: true }
}
Expand Down

0 comments on commit 30a41ff

Please sign in to comment.