Skip to content

Commit

Permalink
fix(compiler-sfc): fix type resolution for symlinked node_modules str…
Browse files Browse the repository at this point in the history
…ucture w/ pnpm

close #10121
  • Loading branch information
yyx990803 committed Jan 18, 2024
1 parent 6fa33e6 commit 75e866b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export interface SFCScriptCompileOptions {
fs?: {
fileExists(file: string): boolean
readFile(file: string): string | undefined
realpath?(file: string): string
}
/**
* Transform Vue SFCs into custom elements.
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler-sfc/src/script/resolveType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ function resolveFS(ctx: TypeResolveContext): FS | undefined {
}
return fs.readFile(file)
},
realpath: fs.realpath,
})
}

Expand Down Expand Up @@ -1048,7 +1049,7 @@ function resolveWithTS(
if (filename.endsWith('.vue.ts')) {
filename = filename.replace(/\.ts$/, '')
}
return filename
return fs.realpath ? fs.realpath(filename) : filename
}
}

Expand Down

0 comments on commit 75e866b

Please sign in to comment.