Open rbalicki2 opened 10 months ago
Upon additional investigation, the issue is that on Mac, we create a Watchman query containing
DirName(
DirNameTerm {
path: "schema-extension.graphql",
depth: None,
},
),
Changing this to schemaExtensions: [folderContainingExtension]
is a workaround.
Thanks for the report and the followup. Should we be creating a different Watchman query here maybe? Or maybe just be more explicit (including validation) that we are expecting directories?
Looks like in the Rust code we are expecting directories here. Maybe we can add a runtime validation that ensures they are existing directories before creating the Watchman query?
We have been using relay for 2 years. Today i tried to install Watchman on my windows laptop to use the --watch
flag and then relay-compiler doesn't work
This is our config file:
// relay.config.js
module.exports = {
schema: 'schema.server.graphql',
src: 'src',
excludes: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
noFutureProofEnums: true,
language: 'typescript',
customScalars: {},
schemaExtensions: ['src/relay/schema.client.graphql'],
};
Our dev deps:
"relay-compiler": "^13.2.0",
"relay-compiler-language-typescript": "^15.0.1",
"relay-config": "^12.0.1",
If i manually add the schema definitions in src/relay/schema.client.graphql
in the end of our schema.server.graphql
it works
I believe the schemaExtensions is supposed to point to a directory that contains *.graphql files with the extensions. At least that is what has worked for me...
I discovered that it functions correctly when both the schema file and the schemaExtensions files are placed in the same directory.
As demonstrated here (modified from @rbalicki2's demo project):
// <project-root>/schema/schema-extension.graphql is the local-schema-extension file
// <project-root>/schema/schema.graphql is the server-schema file
// relay.config.js
module.exports = {
src: "./src",
language: "typescript",
schema: "./schema/schema.graphql",
schemaExtensions: ["./schema"],
excludes: ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"],
};
I'm not sure if this is the intended behavior or a bug.
It looks like schema extensions are ignored on Mac, but not on Linux (x64). Is there a workaround?
Steps to reproduce
yarn && yarn relay
On Mac (platform: darwin, arch: arm64), this fails to compile, due to a missing field. On Linux (platform: linux, arch: x64), this successfully compiles.
The contents of the schema extension file can be arbitrary on Mac; it is never even parsed. However, it must exist.
Thank you!