Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle multiple tsconfig extends for resolving GraphQLSP plugin entry #386

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-seahorses-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gql.tada/internal': patch
---

Update the tsconfig resolver to better handle an array of "extends" values in tsconfig.json files when trying to locate the GraphQLSP plugin entry. Before, if you were using an array for "extends", e.g. `"extends: ["./file1.json", "./file2.json"]`, the first file loaded that did not have a GraphQLSP plugin entry defined would throw an error and prevent subsequent files from being loaded and evaluated. The implemented change now allows for the resolver to continue iterating over `extends` values trying to locate a GraphQLSP plugin entry.
4 changes: 2 additions & 2 deletions packages/internal/src/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ export const loadConfig = async (targetPath?: string): Promise<LoadConfigResult>
if (path.extname(extend) !== '.json') extend += '.json';
try {
const tsconfigPath = await resolveExtend(extend, path.dirname(rootTsconfigPath));
if (tsconfigPath) return load(tsconfigPath);
if (tsconfigPath) return await load(tsconfigPath);
} catch (_error) {}
}
} else if (tsconfig.extends) {
try {
const tsconfigPath = await resolveExtend(tsconfig.extends, path.dirname(rootTsconfigPath));
if (tsconfigPath) return load(tsconfigPath);
if (tsconfigPath) return await load(tsconfigPath);
} catch (_error) {}
}

Expand Down
Loading