I am trying to compile my cross platform project with Scala 3.7.0. The project already compiles with fine with 3.6.4. On JVM everything works fine, however I get following issue on Scala.js:
[warn] package scala contains object and package with same name: caps.
[warn] This indicates that there are several versions of the Scala standard library on the classpath.
[warn] The build should be reconfigured so that only one version of the standard library is on the classpath.
While the error does not say it, the issue is with org.scala-lang:scala3-library_3, which is the one that represents caps as a package instead of object.
When checking dependencyTree for JS version of my project, the only instance of scala3-library used by dependencies is org.scala-lang:scala3-library_3:3.3.0, used by enumeratum macros. This is no surprise, the libraries creators are encouraged to use LTS version.
Typically this kind of issues arise if eviction mechanism picks Scala stdlib (scala3-library_3 artifacts) with version lower then Scala compiler version (scala3-compiler_3 artifacts).
We’ve found out that sometime it can happen when using libraryDependenices := instead of libraryDependenices ++= (probably a hidden stdlib dependency is added by sbt), but it was sometimes also coused by some sbt plugins, eg. the one used by typelevel ecosystem.
One workaround to this problem might be adding explicit dependency scala3-library % scalaVersion.value to ensure that compiler and stdlib are using the same version.