Schema map error - TypeError: Cannot read property 'split' of undefined
Closed this issue ยท 1 comments
If the top level schema name is passed in as a file, say src/schemas/user.graphql
, and user.graphql
only has a single import #import * from 'shared'
, and the schemas
map is { shared: sharedSchemaString }
an error occurs:
TypeError: Cannot read property 'split' of undefined
at isEmptySDL (node_modules/graphql-import/dist/index.js:123:10)
at getDocumentFromSDL (node_modules/graphql-import/dist/index.js:105:9)
at collectDefinitions (node_modules/graphql-import/dist/index.js:148:20)
because this line: https://github.com/graphcool/graphql-import/blob/master/src/index.ts#L200 returns
path.resolve(path.join(dirname, m.from))
instead of m.from
.
I don't think it should operate this way since my import does not end with .graphql
, and therefore the string should come from the map.
If this is a valid issue, I can make a PR to fix the bug ๐
I can currently get around this bug by changing my schema map from:
{ 'shared': shared }
to
{ [path.join(process.cwd(), 'src/schemas/shared')]: shared }
however that is not an obvious solution
๐ This issue has been resolved in version 0.5.1 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐