webpack raw-loader with TypeScript
Another struggle of a day. I had difficulties on importing a GraphQL schema definition in TypeScript project with webpack raw-loader.
Declare in webpack.config.js
to use raw-loader
to import a GraphQL schema definition:
1 | module.exports = { |
Declare in src/raw-loader.d.ts
that an imported GraphQL schema definition is a type of string:
1 | declare module "*.graphql" { |
Declare in tsconfig.json
so that tsc
does not try to compile *.graphql
files:
1 | { |