Support scala.js 1.1.0
Closed this issue · 5 comments
I tried to use a library compiled with scala.js 1.1.0 but got the following exception:
-Error: Scala.js linking failed with the following output:
Exception in thread "main" org.scalajs.ir.IRVersionNotSupportedException: Failed to deserialize a file compiled with Scala.js 1.1 (supported up to: 1.0): /Users/cquiroz/Projects/repro/.cache/https/repo1.maven.org/maven2/io/github/cquiroz/react/common_sjs1_2.13/0.9.1/common_sjs1_2.13-0.9.1.jar:/react/common/ReactComponentProps.sjsir
at org.scalajs.linker.interface.unstable.IRFileImpl$$anonfun$withPathExceptionContext$1.applyOrElse(IRFileImpl.scala:62)
at org.scalajs.linker.interface.unstable.IRFileImpl$$anonfun$withPathExceptionContext$1.applyOrElse(IRFileImpl.scala:58)
at scala.util.Failure.recover(Try.scala:233)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:450)
at scala.concurrent.BatchingExecutor$AbstractBla.concurrent.BatchingExecutor$AbstractBatch.runN(BatchingExecutor.scala:134)
at scala.concurrent.BatchingExecutor$AsyncBatch.apply(BatchingExecutor.scala:163)
at scala.concurrent.BatchingExecutor$AsyncBatch.apply(BatchingExecutor.scala:146)
at scala.concurrent.BlockContext$.usingBlockContext(BlockContext.scala:107)
at scala.concurrent.BatchingExecutor$AsyncBatch.run(BatchingExecutor.scala:154)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: org.scalajs.ir.IRVersionNotSupportedException: This version (1.1) of Scala.js IR is not supported. Supported versions are up to 1.0
at org.scalajs.ir.VersionChecks.checkSupported(ScalaJSVersions.scala:77)
at org.scalajs.ir.Serializers$Deserializer.readHeader(Serializers.scala:980)
at org.scalajs.ir.Serializers$Deserializer.deserializeEntryPointsInfo(Serializers.scala:939)
at org.scalajs.ir.Serializers$.$anonfun$deserializeEntryPointsInfo$1(Serializers.scala:52)
at org.scalajs.ir.Serializers$.withBigEndian(Serializers.scala:67)
at org.scalajs.ir.Serializers$.deserializeEntryPointsInfo(Serializers.scala:52)
at org.scalajs.linker.standard.MemIRFileImpl.$anonfun$entryPointsInfo$1(MemIRFile.scala:31)
at org.scalajs.linker.standard.MemIRFileImpl.$anonfun$withBuffer$1(MemIRFile.scala:39)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:671)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:430)
... 10 more
Can you confirm what setting you have for scalaJSVersion
in your Webpack build? This error looks like it could be the result of trying to load Scala.js 1.1.0 in a Scala.js 1.0.x project, which is not expected to work according to the 1.1.0 release notes:
[Scala.js 1.1.0] is a minor release:
- It is backward binary compatible with all earlier versions in the 1.x series: libraries compiled with 1.0.x can be used with 1.1.0 without change.
- It is not forward binary compatible with 1.0.x: libraries compiled with 1.1.0 cannot be used with 1.0.x.
- It is not entirely backward source compatible: it is not guaranteed that a codebase will compile as is when upgrading from 1.0.x (in particular in the presence of
-Xfatal-warnings
).
Indeed the library is compiled with scala.js 1.1. I tried setting:
scalaJSVersion: "1.1.0"
on webpack
but that gives me this error:
RROR in ./src/scala/.sjsproject
Module build failed (from ./node_modules/scalajs-webpack-loader/dist/bundle.js):
Error: An error happened while downloa
This seems to be the root problem. You would indeed need to set scalaJSVersion
to 1.1.0 to use a library compiled for 1.1.0. However, doing so fails since scalajs-cli
(which the loader uses to compile Scala.js sources) hasn't been published for 1.1.0.
I'll look into this and issue a release once it's fixed.
Thanks a lot, I'll test today
Version 0.0.6 is up on NPM now with the fix to this 🎉 Thank you for reporting this issue!