Reputation: 111
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.
target/scala-2.12/*-jsdeps.js
it doesn't run my main method.target/scala-2.12/scalajs-bundler/main/*-fastopt.js
I get ReferenceError: exports is not defined
in Firefox.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
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
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