Skip to content

Commit

Permalink
fix(file-loader): location path must be normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri committed Jun 30, 2021
1 parent 84deeeb commit a461f90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/loaders/graphql-file/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ export class GraphQLFileLoader implements UniversalLoader<GraphQLFileLoaderOptio
const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd || processCwd(), pointer);
const rawSDL: string = await readFile(normalizedFilePath, { encoding: 'utf8' });

return this.handleFileContent(rawSDL, pointer, options);
return this.handleFileContent(rawSDL, normalizedFilePath, options);
}

loadSync(pointer: SchemaPointerSingle | DocumentPointerSingle, options: GraphQLFileLoaderOptions): Source {
const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd || processCwd(), pointer);
const rawSDL = readFileSync(normalizedFilePath, { encoding: 'utf8' });
return this.handleFileContent(rawSDL, pointer, options);
return this.handleFileContent(rawSDL, normalizedFilePath, options);
}

handleFileContent(rawSDL: string, pointer: string, options: GraphQLFileLoaderOptions) {
Expand Down

0 comments on commit a461f90

Please sign in to comment.