Skip to content

Commit

Permalink
Use a relative path for loading the JS main (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
marzipankaiser authored Sep 2, 2024
2 parents ee7548d + 8c1c057 commit 06dc86e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions effekt/jvm/src/main/scala/effekt/Runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ object JSNodeRunner extends Runner[String] {
def build(path: String)(using C: Context): String =
val out = C.config.outputPath().getAbsolutePath
val jsFilePath = (out / path).canonicalPath.escape
val jsFileName = path.unixPath.split("/").last
// create "executable" using shebang besides the .js file
val jsScript = s"require('${jsFilePath}').main()"
val jsScript = s"require('./${jsFileName}').main()"

os match {
case OS.POSIX =>
val shebang = "#!/usr/bin/env node"
Expand Down Expand Up @@ -183,7 +185,7 @@ object JSWebRunner extends Runner[String] {
import java.nio.file.Path
val out = C.config.outputPath().getAbsolutePath
val jsFilePath = (out / path).unixPath
val jsFileName = jsFilePath.split("/").last
val jsFileName = path.unixPath.split("/").last
val htmlFilePath = jsFilePath.stripSuffix(s".$extension") + ".html"
val mainName = "$" + jsFileName.stripSuffix(".js") + ".main"
val htmlContent =
Expand Down

0 comments on commit 06dc86e

Please sign in to comment.