Skip to content

Commit

Permalink
TS transpilation source root fix (#24)
Browse files Browse the repository at this point in the history
We also need to consider sub-projects here.
  • Loading branch information
max-leuthaeuser authored Oct 19, 2021
1 parent 6bf284e commit cba7edf
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ class TypescriptTranspiler(override val config: Config,
(Some(customTsConfigFile), s"--project $customTsConfigFile")
}
}

val projOutDir =
if (proj.nonEmpty) outDir / proj.substring(0, proj.lastIndexOf("/")) else outDir
val sourceRootDir =
if (proj.nonEmpty) File(projectPath) / proj.substring(0, proj.lastIndexOf("/"))
else File(projectPath)

val command =
s"$tsc -sourcemap --sourceRoot $projectPath --outDir $projOutDir -t ES2015 -m $module --jsx react --noEmit false $projCommand"
s"$tsc -sourcemap --sourceRoot $sourceRootDir --outDir $projOutDir -t ES2015 -m $module --jsx react --noEmit false $projCommand"
logger.debug(
s"\t+ TypeScript compiling $projectPath $projCommand to $projOutDir (using $module style modules)")

ExternalCommand.run(command, projectPath.toString, extraEnv = NODE_OPTIONS) match {
case Success(result) =>
logger.debug(s"\t+ TypeScript compiling finished. $result")
Expand Down

0 comments on commit cba7edf

Please sign in to comment.