Skip to content

Publish a GitHub release with WebAssembly assets so shinylive can install shinyreact #268

Description

@schloerke

Problem

shinyreact can't be used in a shinylive app (Quarto {shinylive-r} block, or
shinylive::export()) because there is no WebAssembly binary for it anywhere, and
the one mechanism shinylive has for GitHub-installed packages needs a release that
this repo doesn't have.

shinylive:::get_github_wasm_assets() handles exactly this case. When a package is
installed from GitHub, it reads RemoteUsername / RemoteRepo / RemoteRef from
the installed DESCRIPTION and looks for a GitHub release tagged with that ref,
carrying library.data* and library.js.metadata assets:

tags <- gh::gh("/repos/{user}/{repo}/releases/tags/{ref}", ...)
library_data     <- Filter(\(i) grepl("library.data", i$name, fixed = TRUE), tags$assets)
library_metadata <- Filter(\(i) i$name == "library.js.metadata",             tags$assets)

This repo has zero releases, so gh::gh() 404s and the Quarto render aborts:

Error in `get_github_wasm_assets()`:
  Can't find GitHub release for github::posit-dev/shinyreact@HEAD
! Ensure a GitHub release exists for the package repository reference: "HEAD".

Reproduce

pak::pak("posit-dev/shinyreact/pkg-r")   # note: R package is in the pkg-r subdir

Then render a Quarto revealjs/html doc containing:

```{shinylive-r}
#| standalone: true
library(shiny)
library(shinyreact)
# ... any shinyreact app
```

Proposed fix

Build and attach WebAssembly assets on release with
https://github.com/r-wasm/actions (build-rwasm / release-rwasm). Two
repo-specific details:

  • The R package lives in pkg-r/, not the repo root, so the action needs the
    subdirectory configured. (For the same reason, plain
    pak::pak("posit-dev/shinyreact") fails with "Can't find R package in GitHub
    repo"
    — it must be posit-dev/shinyreact/pkg-r.)
  • The release tag has to match the RemoteRef recorded at install time. A default
    pak::pak("posit-dev/shinyreact/pkg-r") records RemoteRef: HEAD, so a release
    tagged HEAD is what an unpinned install looks for; a versioned tag works for
    users who install that ref explicitly.

shinyreact itself is pure R, so nothing needs compiling for wasm — but its
Imports include brio, which does have C code. brio 1.1.5 is already on
repo.r-wasm.org, so a runtime install resolves it fine as long as
https://repo.r-wasm.org stays in the repo list.

Things that do not solve this

  • Adding the package to an r-universe. r-universe does build wasm binaries, but
    currently only for R 4.6 (bin/emscripten/contrib/4.6/), and shinylive 0.10.8
    runs R 4.5.1 (wasm32-unknown-emscripten). Separately, shinylive's resolver
    keys off GitHub releases, not the r-universe repo — an r-universe install has no
    Remote* fields, so it gets treated as CRAN-ish and is looked for on
    repo.r-wasm.org.

Current workaround

For https://github.com/schloerke/presentation-2026-09-15-posit-conf-shinyreact
(a posit::conf(2026) talk), the deck ships its own single-package webR repo and
installs at runtime:

webr::install(
  "shinyreact",
  repos = c("<deck>/wasm-repo", "https://repo.r-wasm.org")
)

with SHINYLIVE_WASM_PACKAGES=0 set at render time purely to skip the
get_github_wasm_assets() lookup above. That works, but every consumer has to
rebuild and host a binary themselves. A release with wasm assets removes all of it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions