Skip to content

Commit 2a73c57

Browse files
reverted resolveLuaDependencyPathFromNodeModules because the changes are
no longer needed
1 parent a45d888 commit 2a73c57

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/transpilation/resolve.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)