I set up a very simple scala.js project with this very simple "application":
package example
import org.scalajs.dom._
import scala.scalajs.js.JSApp
class EverythingWorks extends JSApp {
def main() = {
console.log("It works!")
}
}
The corresponding HTML looks the following:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript">
example.EverythingWorks().main();
</script>
</body>
</html>
Now, I did sbt fastOptJS, copied the generated JS file to js/app.js and the js.map file next to app.js.
Instead of printing "It works!" on the console, I get ReferenceError: example is not defined. I double-checked that app.js is found from the HTML.
What am I missing?