Skip to content

Commit

Permalink
fix: only redirect aliased entry on optimized
Browse files Browse the repository at this point in the history
fix #369
  • Loading branch information
yyx990803 committed Jun 8, 2020
1 parent ae2ab0f commit 429416d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/node/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,12 @@ export function resolveBareModuleRequest(
const deepMatch = !isEntry && id.match(deepImportRE)
if (deepMatch) {
const depId = deepMatch[1] || deepMatch[2]
if (resolver.alias(depId) === id) {
// this is a deep import but aliased from a bare module id.
return resolveBareModuleRequest(root, depId, importer, resolver)
}
if (resolveOptimizedModule(root, depId)) {
if (resolver.alias(depId) === id) {
// this is a deep import but aliased from a bare module id.
// redirect it the optimized copy.
return resolveBareModuleRequest(root, depId, importer, resolver)
}
console.error(
chalk.yellow(
`\n[vite] Avoid deep import "${id}" (imported by ${importer})\n` +
Expand Down

0 comments on commit 429416d

Please sign in to comment.