Skip to content

Commit 69693f0

Browse files
committed
Generate and use a full luaEntry path if project is specified
1 parent 6500548 commit 69693f0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/LuaTransformer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,14 @@ export class LuaTransformer {
126126
);
127127

128128
if (this.options.luaEntry) {
129-
const sourceFile = this.program.getSourceFile(this.options.luaEntry);
129+
// If specified via CLI, the program's host should pick up a relative luaEntry path
130+
let luaEntryPath = this.options.luaEntry;
131+
if (this.options.project) {
132+
// If specified via project. Figure out the full path to the file based off the project's path
133+
const tsconfigDirectory = path.dirname(path.resolve(this.options.project));
134+
luaEntryPath = path.resolve(tsconfigDirectory, this.options.luaEntry);
135+
}
136+
const sourceFile = this.program.getSourceFile(luaEntryPath);
130137
if (sourceFile) {
131138
const formattedEntryName = tsHelper.getExportPath(sourceFile.fileName, this.options);
132139
const requireCall = this.createModuleRequire(ts.createStringLiteral(formattedEntryName), false);

0 commit comments

Comments
 (0)