Timothée Jourde
Timothée Jourde

Reputation: 111

scalajs-bundler: which compiled file should be included in HTML?

I'm trying to handle my JS dependencies with scalajs-bundler for my Scala.js project. It successfully downloads my dependency (d3.js), but I don't know how to include my code and the dependency in my HTML file.

I tried every files I found on target/scala-2.12/ but it didn't work.

I don't want to use a facade, this is a short-term project and I plan to use js.Dynamic.

A side question: can I still use source maps with scalajs-bundler ?

Thanks.

Upvotes: 1

Views: 349

Answers (2)

Timothée Jourde
Timothée Jourde

Reputation: 111

Ok, the problem was that the final bundle file *-fastopt-bundle.js (the one to include) was missing, and apparently it was because webpack was silently unable to run because npm packages are referring to node (and not nodejs) in their shebang.

So the solution was to install nodejs-legacy on Ubuntu.

Upvotes: 1

gzm0
gzm0

Reputation: 14842

You will need to include both the *-jsdeps.js and the *-fastopt.js.

*-jsdeps.js contains your dependencies, *-fastopt.js contains the Scala.js code (and the invocation of the main method if you enable scalaJSUseMainModuleInitializer).

Upvotes: 0

Related Questions