orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
514 stars 220 forks source link

Companion classes don't work in offline mode #5635

Closed ebruchez closed 1 year ago

ebruchez commented 1 year ago

Getting error:

baseline.js?updates=offline:462081 scala.scalajs.js.JavaScriptException: TypeError: Class constructor $b_Lorg_orbeon_xbl_Grid$GridCompanion cannot be invoked without 'new'

In offline, we use ESVersion.ES2018 for "improved regular expressions", and so our subclassing code in xforms.js fails.

ebruchez commented 1 year ago

If we switch all to ESVersion.ES2018, which we can do now, we only need one solution. In JavaScript, I can now do it. However our antiquated sbt-uglify is unable to process JavaScript containing classes. So I wondered whether this could be written in Scala.js, and the answer is "yes" for the subclassing (via hack), but calling super.init() causes a compiler error. See https://github.com/scala-js/scala-js/issues/4801.

So for now either:

ebruchez commented 1 year ago

For now, chose JavaScript solution.