Skip to content

Commit

Permalink
fix(optimizer): resolve linked dep from relative root
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBonaventure committed Jan 5, 2021
1 parent 67a3c44 commit ca79884
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/vite/src/node/optimizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export async function optimizeDeps(
if (options.link) {
for (const linkedDep of options.link) {
await resolveLinkedDeps(
config.root,
linkedDep,
qualified,
external,
Expand Down Expand Up @@ -364,7 +365,14 @@ async function resolveQualifiedDeps(

if (linked.length) {
for (const dep of linked) {
await resolveLinkedDeps(dep, qualified, external, config, aliasResolver)
await resolveLinkedDeps(
root,
dep,
qualified,
external,
config,
aliasResolver
)
}
}

Expand All @@ -375,13 +383,14 @@ async function resolveQualifiedDeps(
}

async function resolveLinkedDeps(
root: string,
dep: string,
qualified: Record<string, string>,
external: string[],
config: ResolvedConfig,
aliasResolver: PluginContainer
) {
const depRoot = path.dirname(resolveFrom(`${dep}/package.json`, config.root))
const depRoot = path.dirname(resolveFrom(`${dep}/package.json`, root))
const { qualified: q, external: e } = await resolveQualifiedDeps(
depRoot,
config,
Expand Down

0 comments on commit ca79884

Please sign in to comment.