]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-sfc): fix type resolution for symlinked node_modules structure w/ pnpm
authorEvan You <yyx990803@gmail.com>
Thu, 18 Jan 2024 05:52:42 +0000 (13:52 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 18 Jan 2024 05:52:42 +0000 (13:52 +0800)
close #10121

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

index 69beb2af79677a61211b9c50715444a55aaf3d36..46fc65c0069c209714520ee9ecc7cea5863c0aa6 100644 (file)
@@ -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.
index 548d5d13c6d639f3101172ddc48382520fb983bc..968c168ddb94edcc5930e312af06313fb64cb05a 100644 (file)
@@ -860,6 +860,7 @@ function resolveFS(ctx: TypeResolveContext): FS | undefined {
       }
       return fs.readFile(file)
     },
+    realpath: fs.realpath,
   })
 }
 
@@ -1048,7 +1049,7 @@ function resolveWithTS(
     if (filename.endsWith('.vue.ts')) {
       filename = filename.replace(/\.ts$/, '')
     }
-    return filename
+    return fs.realpath ? fs.realpath(filename) : filename
   }
 }