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

Handle empty module report list in Scala.js modifier #630

Open
keynmol opened this issue Feb 27, 2022 · 1 comment
Open

Handle empty module report list in Scala.js modifier #630

keynmol opened this issue Feb 27, 2022 · 1 comment
Labels

Comments

@keynmol
Copy link
Collaborator

keynmol commented Feb 27, 2022

Prior to 2.3.1, Mdoc.js was using a deprecated SJS API which explicitly wrote out an empty file if the list of produced JS modules is empty: https://github.com/scala-js/scala-js/blob/main/linker-interface/shared/src/main/scala/org/scalajs/linker/interface/ReportToLinkerOutputAdapter.scala#L51-L53

This can happen if your document only has mdoc:js:shared and mdoc:js:compile-only, none of which introduce a runnable entrypoint.

Most recently it was seen in PurpleKingdomGames/tyrian#70

In terms of error reporting, this looks like a regression, as there's nothing explicitly bad about only have shared/compile-only snippets

@keynmol keynmol added the bug label Feb 27, 2022
@armanbilge
Copy link
Contributor

Besides the single-file and no-file cases, does many-file output need to be considered as well? This is for example used by the ES module linking mode I believe. The legacy API was also unable to handle this.

val linkingReport = scalajsApi.get.link(sjsirFiles.toArray)
val content = linkingReport.values().iterator().next()

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

No branches or pull requests

2 participants