Skip to content

Commit

Permalink
fix: crawl dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Aug 9, 2021
1 parent 28a9612 commit e57b8c3
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,13 @@ function esbuildScanPlugin(
if (shouldExternalizeDep(resolved, id)) {
return externalUnlessEntry({ path: id })
}
if (resolved.includes('node_modules') || include?.includes(id)) {
// dependency or forced included, externalize and stop crawling
if (OPTIMIZABLE_ENTRY_RE.test(resolved)) {
depImports[id] = resolved
}
return externalUnlessEntry({ path: id })
} else {
const namespace = htmlTypesRE.test(resolved) ? 'html' : undefined
// linked package, keep crawling
return {
path: path.resolve(resolved),
namespace
}
if (OPTIMIZABLE_ENTRY_RE.test(resolved)) {
depImports[id] = resolved
}
const namespace = htmlTypesRE.test(resolved) ? 'html' : undefined
return {
path: path.resolve(resolved),
namespace
}
} else {
missing[id] = normalizePath(importer)
Expand Down

0 comments on commit e57b8c3

Please sign in to comment.