Closed doofin closed 4 years ago
Please elaborate, at least with some kind of reproduction. Currently this report is not actionable.
Sorry for that,I have add more info.
Just because you listed this as a dependency, doesn't mean it will be added to the bundle, only that it will be added to the list of dependencies in package.json. You also need to define a @JSImport
in your code (see scala.js docs for the exact syntax) referencing this dependency, and then also make sure to reference the JSImport-ed object
from a val
so that it doesn't get dead-code-eliminated (objects are lazy so if not accessed scala.js will eliminate them from the bundle).
Thank you! I will have a look.
object f2 {
@js.native
@JSGlobal("marked")
def marked(string: String): Node =
js.native
}
Still not working,maybe due to the irregular layout of the lib
You need to somehow use @JSImport
, not @JSGlobal
. (Or not using scalajs-bundler at all...)
@doofin Here is a simple facade for marked:
https://github.com/woost/wust2/blob/master/webUtil/src/main/scala/wust/facades/marked/Marked.scala
Thanks! @fdietze
It seems that some kind of js lib is not bundled ,like https://www.npmjs.com/package/marked .
sbt Setup :
browser complains about marked is not defined.However,include this script directly via script tag works().