简体   繁体   中英

Use javascript in Scala.js compiled jars

I have a Scala.js jar, foo_sjs0.6_2.11-0.1-SNAPSHOT.jar, which contains javascript for my web server, and a separated Play project for controlers/views/etc.

Is there any way to compile and load .js files at runtime when I run the Play project, given it has foo_sjs0.6_2.11-0.1-SNAPSHOT.jar as a dependency?

P/S: I'm well aware of Play-Scala.js multi-project settings https://github.com/vmunier/play-with-scalajs-example , and I don't want that.

It's possible. You just have to use the Scala.js Tools API programmatically to link the .sjsir files in the jars into a .js file. Look at how the CLI linker does it for inspiration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM