A build tool that generates Scala.js bindings from GraphQL schemas and Relay-compiled queries. It replaces the default Flow type generation of the relay-compiler with Scala.js native traits, enabling type-safe GraphQL queries in Scala.js applications. Current version 0.12.4 is experimental and supports Relay specifications. It uses a regex-based approach to extract GraphQL operations from Scala source files annotated with @gql. Differentiating from similar tools like Apollo Scala.js, it integrates closely with the Relay ecosystem and supports deep hierarchical graph structures, spreading, and custom scalajs annotations.
npm install scala-relay-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Complete workflow to set up scala-relay-compiler with a GraphQL schema and Scala source files.
Ensure @gql("""...""") is exactly as specified; do not use string interpolation or concatenation inside @gql.Pin relay-compiler version to match the scala-relay-compiler's expected version (e.g., relay-compiler 1.6.2 for scala-relay-compiler 0.11.0).
Check the changelog and README for version compatibility before upgrading.
Ensure your project is configured for Scala.js (e.g., sbt-scalajs plugin) and includes the relay runtime library.
Verify that the @gql annotation is exactly `@gql("""...""")` with no extra whitespace or newlines between `@gql` and the opening quote.Run `npm install --save-dev relay-compiler`.
Ensure the code is compiled with Scala.js and the resulting JavaScript is run in a browser or Node.js environment with the Scala.js runtime loaded.