Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lsp): support node_modules in tsconfig resolution (#266)

authored by

Jovi De Croock and committed by
GitHub
472a03dd ffc28b96

+11 -2
+5
.changeset/witty-pigs-approve.md
··· 1 + --- 2 + '@0no-co/graphqlsp': minor 3 + --- 4 + 5 + Leverage `require.resolve` when following `tsconfig.extends` so we support `node_modules`
+6 -2
packages/graphqlsp/src/graphql/getSchema.ts
··· 147 147 return path.dirname(tsconfigPath); 148 148 } else if (Array.isArray(parsed.extends)) { 149 149 return parsed.extends.find(p => { 150 - const resolved = path.resolve(path.dirname(tsconfigPath), p); 150 + const resolved = require.resolve(p, { 151 + paths: [path.dirname(tsconfigPath)], 152 + }); 151 153 return getRootDir(info, resolved); 152 154 }); 153 155 } else if (parsed.extends) { 154 - const resolved = path.resolve(path.dirname(tsconfigPath), parsed.extends); 156 + const resolved = require.resolve(parsed.extends, { 157 + paths: [path.dirname(tsconfigPath)], 158 + }); 155 159 return getRootDir(info, resolved); 156 160 } 157 161 };