Skip to content
Permalink
Browse files
fix: esbuildOutputFromId for symlinked root (#10154)
  • Loading branch information
patak-dev committed Sep 18, 2022
1 parent aebfd9c commit fc5310f3e3f500412aaf5e45a5871088a662d0e5
Showing 1 changed file with 15 additions and 5 deletions.
@@ -911,12 +911,22 @@ function esbuildOutputFromId(
id: string,
cacheDirOutputPath: string
): any {
const cwd = process.cwd()
const flatId = flattenId(id) + '.js'
return outputs[
normalizePath(
path.relative(process.cwd(), path.join(cacheDirOutputPath, flatId))
)
]
const normalizedOutputPath = normalizePath(
path.relative(cwd, path.join(cacheDirOutputPath, flatId))
)
const output = outputs[normalizedOutputPath]
if (output) {
return output
}
// If the root dir was symlinked, esbuild could return output keys as `../cwd/`
// Normalize keys to support this case too
for (const [key, value] of Object.entries(outputs)) {
if (normalizePath(path.relative(cwd, key)) === normalizedOutputPath) {
return value
}
}
}

export async function extractExportsData(

0 comments on commit fc5310f

Please sign in to comment.