File tree 1 file changed +15
-5
lines changed
packages/vite/src/node/optimizer
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -911,12 +911,22 @@ function esbuildOutputFromId(
911
911
id : string ,
912
912
cacheDirOutputPath : string
913
913
) : any {
914
+ const cwd = process . cwd ( )
914
915
const flatId = flattenId ( id ) + '.js'
915
- return outputs [
916
- normalizePath (
917
- path . relative ( process . cwd ( ) , path . join ( cacheDirOutputPath , flatId ) )
918
- )
919
- ]
916
+ const normalizedOutputPath = normalizePath (
917
+ path . relative ( cwd , path . join ( cacheDirOutputPath , flatId ) )
918
+ )
919
+ const output = outputs [ normalizedOutputPath ]
920
+ if ( output ) {
921
+ return output
922
+ }
923
+ // If the root dir was symlinked, esbuild could return output keys as `../cwd/`
924
+ // Normalize keys to support this case too
925
+ for ( const [ key , value ] of Object . entries ( outputs ) ) {
926
+ if ( normalizePath ( path . relative ( cwd , key ) ) === normalizedOutputPath ) {
927
+ return value
928
+ }
929
+ }
920
930
}
921
931
922
932
export async function extractExportsData (
You can’t perform that action at this time.
0 commit comments