Compdigitec Labs

« | Home

Scala.js – Referring to non-existent class

By admin | September 9, 2021

Referring to non-existent class MyClass$
  called from JSClass$.jsMethod()void
  called from JSClass$.$js$exported$meth$jsMethod()java.lang.Object
  exported to JavaScript with @JSExport
involving instantiated classes:
  JSClass$
    exported to JavaScript with @JSExport
Cannot access module for non-module MyClass$
  called from JSClass$.jsMethod()void
  called from JSClass$.$js$exported$meth$jsMethod()java.lang.Object
  exported to JavaScript with @JSExport
involving instantiated classes:
  JSClass$
    exported to JavaScript with @JSExport

Related issue: https://github.com/scala-js/scala-js/issues/629

If the issue is coming from a shared module being used in both a Scala.js and JVM setting, the issue may be that the shared module is not being compiled for Scala.js. We can fix that as follows by compiling it for both. Mill example below:

object MyObject extends ScalaModule with ScalaJSModule with ScalafmtModule {
  // ...
}

// Instead of

object MyObject extends ScalaModule with ScalafmtModule {
  // ...
}

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Code | 1 Comment »

One Response to “Scala.js – Referring to non-existent class”

  1. Antony Christ Says:
    April 12th, 2022 at 08:09

    Are you in need of professional assignment helpers? Well! You have reached the right place at My Case Study Help.Com where you receive a one-stop solution. We offer one of the finest MBA Assignment Help for students’ benefit. We have more than 5000 professional Case Study Writer experts to support students in doing their university projects. We provide assured quality and credibility. That’s why a majority of students trust our Assignment Help.

Comments