Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to compile a Scala JS project #804

Open
mcallisto opened this issue Sep 8, 2024 · 2 comments
Open

Question: how to compile a Scala JS project #804

mcallisto opened this issue Sep 8, 2024 · 2 comments

Comments

@mcallisto
Copy link

I understand from #604 (comment) that it is possible to use the scala-maven-plugin to compile a project as Scala JS.

But I would need some help, from @jam01 or any other kind soul, in order to actually understand how.

I have a Scala3 project which is perfectly compiled on the JVM thanks to the plugin by using this POM.xml https://gist.github.com/mcallisto/29bfd600a13f885e904d83b7d9b37f64

On the other hand I tried to compile it as Scala JS by using (derived maybe incorrectly from https://github.com/jam01/json-schema/blob/0.1.0/js/pom.yaml) this modified POM.xml https://gist.github.com/mcallisto/1557877830225b06ebe9de0c80ae4ffc

But the compile phase fails with these errors:

[INFO] --- scala:4.9.1:compile (default) @ foo ---
[INFO] compiling 5 Scala sources to /.../foo/target/classes ...
[ERROR] /.../foo/Logic.scala:10:20: package scala.scalajs.js does not have a member method constructorOf
[ERROR] /.../foo/Logic.scala:12:15: package scala.scalajs.js.Dynamic does not have a member field or getter literal
[...many more of the same...]

Any hint?

@mcallisto
Copy link
Author

I just want to add that my project (a library, with no main method) can be successfully compiled as Scala JS by sbt, so in my view the code itself is not causing the issue.

@jam01
Copy link

jam01 commented Sep 18, 2024

Try removing the scala3-library_3 dep. You shouldn't need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants