File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,22 +220,20 @@ class ResolutionContext {
220220 requiringFile : ProcessedFile ,
221221 dependency : string
222222 ) : string | undefined {
223-
224223 // We don't know for sure where the lua root is, so guess it is at package root
225224 const splitPath = path . normalize ( requiringFile . fileName ) . split ( path . sep ) ;
226225 let packageRootIndex = splitPath . lastIndexOf ( "node_modules" ) + 2 ;
227- const packageRoot = splitPath . slice ( 0 , packageRootIndex ) . join ( path . sep ) ;
228- let currentPackage = packageRoot ;
226+ let packageRoot = splitPath . slice ( 0 , packageRootIndex ) . join ( path . sep ) ;
229227
230228 while ( packageRootIndex < splitPath . length ) {
231229 // Try to find lua file relative to currently guessed Lua root
232- const resolvedPath = path . join ( currentPackage , dependency ) ;
230+ const resolvedPath = path . join ( packageRoot , dependency ) ;
233231 const fileFromPath = this . getFileFromPath ( resolvedPath ) ;
234232 if ( fileFromPath ) {
235233 return fileFromPath ;
236234 } else {
237235 // Did not find file at current root, try again one directory deeper
238- currentPackage = path . join ( currentPackage , splitPath [ packageRootIndex ++ ] ) ;
236+ packageRoot = path . join ( packageRoot , splitPath [ packageRootIndex ++ ] ) ;
239237 }
240238 }
241239
You can’t perform that action at this time.
0 commit comments