-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
Description
Version(s)
scala-cli 1.8.1
Describe the bug
Command scala-cli package --js --js-module-kind es index.scala fails against source code index.scala below:
//> using platform js
//> using scala 3.7
import scala.scalajs.js.annotation.*
object Index {
@JSExportTopLevel(name = "handler", moduleID = "index")
def handler(): Unit = {
println("Hello world!")
}
}It results:
Compiling project (Scala 3.7.1, Scala.js 1.19.0)
Compiled project (Scala 3.7.1, Scala.js 1.19.0)
[error] Error: main.js not found after Scala.js linking (found index.js)
It works when main method is added:
//> using platform js
//> using scala 3.7
import scala.scalajs.js.annotation.*
object Index {
@JSExportTopLevel(name = "handler", moduleID = "index")
def handler(): Unit = {
println("Hello world!")
}
}
object Hello {
def main(args: Array[String]): Unit = 42
}But I need no main method because I just want ESM.
To Reproduce
Run command for same source code.
Expected behaviour
scala-cli can build scala source code without main method using Scala.js.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In progress