Skip to content

Commit 75e866b

Browse files
committed
fix(compiler-sfc): fix type resolution for symlinked node_modules structure w/ pnpm
close #10121
1 parent 6fa33e6 commit 75e866b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/compiler-sfc/src/compileScript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export interface SFCScriptCompileOptions {
118118
fs?: {
119119
fileExists(file: string): boolean
120120
readFile(file: string): string | undefined
121+
realpath?(file: string): string
121122
}
122123
/**
123124
* Transform Vue SFCs into custom elements.

packages/compiler-sfc/src/script/resolveType.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ function resolveFS(ctx: TypeResolveContext): FS | undefined {
860860
}
861861
return fs.readFile(file)
862862
},
863+
realpath: fs.realpath,
863864
})
864865
}
865866

@@ -1048,7 +1049,7 @@ function resolveWithTS(
10481049
if (filename.endsWith('.vue.ts')) {
10491050
filename = filename.replace(/\.ts$/, '')
10501051
}
1051-
return filename
1052+
return fs.realpath ? fs.realpath(filename) : filename
10521053
}
10531054
}
10541055

0 commit comments

Comments
 (0)