Open xfactor2000 opened 4 years ago
Correction - same things happens during fullOpt and fastOpt for regular modules as well:
While using jquery-ui
plugin with this facade:
@JSImport("jquery", Namespace)
@js.native
object jQuery extends jQueryUI {
def ready(handler: js.Function): Unit = js.native
def apply(handler: js.Any): this.type = js.native
def remove(): Unit = js.native
def keyup(handler: js.Function1[js.Dynamic,Unit]):Unit = js.native
def keypress(handler: js.Function1[js.Dynamic,Unit]):Unit = js.native
@JSName("val")
def value(): String = js.native
def html(value:String):Unit = js.native
def text(): String = js.native
def is(attr: String):Boolean = js.native
@JSName("val")
def value(value: String): js.Dynamic = js.native
@JSName("val")
def valueSet(value: String): Unit = js.native
def show(): Unit = js.native
def click(handler: js.ThisFunction): Unit = js.native
@JSName("get")
def getDomElement(index:Int): dom.html.Element = js.native
def on(event: String, handler: js.ThisFunction): Unit = js.native
def bind(event: String, handler: js.Function): Unit = js.native
def append(element: js.Dynamic): Unit = js.native
def append(element: js.Object): Unit = js.native
def append(html: String): Unit = js.native
def get(url:String, handler: js.Function1[js.Dynamic,Unit]): Unit = js.native
def post(url:String, data: js.Object):Callback = js.native
def prop(name:String, value: Boolean): Unit = js.native
def prop(name:String): Boolean = js.native
}
@JSImport("jquery-ui", Namespace)
@js.native
class jQueryUI extends js.Object{
def slider(options:js.Dynamic):Unit = js.native
}
@js.native
trait Callback extends js.Object {
def done(handler:js.Function):Callback = js.native
def fail(handler: js.Function1[js.Object, Unit]):Callback = js.native
}
This is the code that gets generated, you can see that jquery-ui
is imported before jquery
module.
var $i_flatpickr = require("flatpickr");
var $i_leaflet = require("leaflet");
var $i_leaflet$002dsidebar$002dv2 = require("leaflet-sidebar-v2");
var $i_luxon = require("luxon");
var $i_sweetalert2 = require("sweetalert2");
var $i_jquery$002dui = require("jquery-ui");
var $i_leaflet$002dsidebar = require("leaflet-sidebar");
var $i_jquery = require("jquery");
var $i_leaflet$002eicon$002eglyph = require("leaflet.icon.glyph");
var $i_leaflet$002dpolylinedecorator = require("leaflet-polylinedecorator");
Hi, I use Mill for compiling Scala.js frontend application. I noticed that for
test
task, the JS requirements are ordered incorrectly, while forfastOpt
andfullOpt
everything seems to work fine.In my code, I have written a Leaflet.js facade:
As you see, I'm using several additional Leaflet modules such as
leaflet-sidebar
. While running the tests, I got an exception:I dag into
out.js
infastOptTest
folder and found the problem:As you see, "leaflet" is imported after "leaflet-sidebar", which is incorrect. In
fastOpt
folder'sout.js
the code is generated correctly:The same test code compiled and ran perfectly on SBT.