fix(config): make compiler.relay.src optional for Relay multi-project configs#95707
Open
Alexoswin wants to merge 1 commit into
Open
fix(config): make compiler.relay.src optional for Relay multi-project configs#95707Alexoswin wants to merge 1 commit into
Alexoswin wants to merge 1 commit into
Conversation
… configs The compiler.relay config schema required a `src` string even though it is never read by the webpack/swc-loader or Turbopack relay transforms (only artifactDirectory, language, and eagerEsModules are consumed). This made it impossible to use Relay's multi-project config format (relay.config.js with `projects`), which has no top-level `src`, without supplying an unused dummy value just to pass validation. Fixes vercel#73097
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
compiler.relay.srcis currently required by Next.js's config schema, butit's never actually consumed by the SWC/webpack relay transform or the
Turbopack relay transform — only
artifactDirectory,language, andeagerEsModulesare used. This made it impossible to use Relay's officialmulti-project config format (
relay.config.jswith aprojectsmap),which has no single top-level
src, without adding an unused dummy valuejust to satisfy validation.
Why?
Fixes #73097. Relay's multi-project mode is a supported, documented Relay
configuration shape (https://relay.dev/docs/guides/compiler-multi-project/),
so Next.js's config validation shouldn't require a field that the compiler
integration doesn't need.
How?
srcoptional in thecompiler.relayZod schema(
packages/next/src/server/config-schema.ts) and the correspondingTypeScript type (
packages/next/src/server/config-shared.ts).transform (
turbopack/crates/turbopack-ecmascript-plugins/src/transform/relay.rs),confirming
srchas no other read sites in that crate.test/e2e/relay-graphql-swc-multi-projectfixtureto drop the now-unnecessary dummy
srcvalues, demonstrating themulti-project shape validates and builds without it.
Fixes #73097