node.js – src/index.ts:12:22 – error TS2307: Cannot find module ‘./schema.graphql’ or its corresponding type declarations
hi I want to import a graphql file. For this i have installed babel-plugin-import-graphql package.but for some reason i am getting error
node_modulests-nodesrcindex.ts:750
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:12:22 - error TS2307: Cannot find module './schema.graphql' or its corresponding type declarations.
12 import typeDefs from "./schema.graphql";
~~~~~~~~~~~~~~~~~~
how do i do the import
import typeDefs from "./schema.graphql";
graphql.d.ts
declare module "*.graphql" {
import { DocumentNode } from "graphql";
const value: DocumentNode;
export = value;
}
.babelrc
{
"plugins": ["import-graphql"]
}
full code can be viewed here
Read more here: Source link