Skip to content

Relay and NextJS #3889

@jantimon

Description

@jantimon

Maybe you saw it already that every NextJS project ships now with Relay support by default!

https://nextjs.org/blog/next-12-1
Blog_-_Next_js_12_1___Next_js

Basically it means that the swc version of the babel-plugin-relay is built in and can be configured directly in the next.js config:

// next.config.js
module.exports = {
  compiler: {
    relay: {
      // This should match relay.config.js
      src: './',
      artifactDirectory: './__generated__',
      language: 'typescript',
    },
  },
}

NextJS does not provide a concept for splitting data loading into components. (beside from waterfall loading)
For me this makes Relay a perfect match for many medium-sized to large NextJS websites and applications.

NextJS got incredibly popular for its simplicity - unfortunately setting up Relay for NextJS is really hard.

It has been tried several times but most tries got abandoned after the POC phase:

I believe this could be done better and I believe that if someone from the Relay team could invest time here to connect the power of Relays typesafe modular data loading with NextJs it might be a big push for Relays popularity and could help the entire ecosystem.

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