File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/react-router-dev/config Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -841,12 +841,19 @@ function findEntry(
841841function isEntryFileDependency (
842842 moduleGraph : Vite . ModuleGraph ,
843843 entryFilepath : string ,
844- filepath : string
844+ filepath : string ,
845+ visited = new Set < string > ( )
845846) : boolean {
846847 // Ensure normalized paths
847848 entryFilepath = Path . normalize ( entryFilepath ) ;
848849 filepath = Path . normalize ( filepath ) ;
849850
851+ if ( visited . has ( filepath ) ) {
852+ return false ;
853+ }
854+
855+ visited . add ( filepath ) ;
856+
850857 if ( filepath === entryFilepath ) {
851858 return true ;
852859 }
@@ -857,8 +864,16 @@ function isEntryFileDependency(
857864 return false ;
858865 }
859866
867+ // Recursively check all importers to see if any of them are the entry file
860868 for ( let importer of mod . importers ) {
861- if ( importer . id === entryFilepath ) {
869+ if ( ! importer . id ) {
870+ continue ;
871+ }
872+
873+ if (
874+ importer . id === entryFilepath ||
875+ isEntryFileDependency ( moduleGraph , entryFilepath , importer . id , visited )
876+ ) {
862877 return true ;
863878 }
864879 }
You can’t perform that action at this time.
0 commit comments