chore: Add ability to import .graphql files

Change next-js config to be able to write

```
import typeDefs from './schema.graphql'
```
This commit is contained in:
joy_void_joy 2022-06-17 21:39:03 +02:00
parent c8361f1748
commit 2e5ea40953
4 changed files with 23 additions and 0 deletions

6
web/@types/graphql.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
declare module '*.graphql' {
import { DocumentNode } from 'graphql'
const Schema: DocumentNode
export = Schema
}

View File

@ -2,6 +2,17 @@ const API_DOCS_URL = 'https://docs.manifold.markets/api'
/** @type {import('next').NextConfig} */
module.exports = {
webpack: (config) => {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
})
return config
},
webpackDevMiddleware: (config) => {
return config
},
staticPageGenerationTimeout: 600, // e.g. stats page
reactStrictMode: true,
optimizeFonts: false,

View File

@ -36,6 +36,7 @@
"daisyui": "1.16.4",
"dayjs": "1.10.7",
"firebase": "9.6.0",
"graphql": "16.5.0",
"gridjs": "5.0.2",
"gridjs-react": "5.0.2",
"lodash": "4.17.21",

View File

@ -6602,6 +6602,11 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4,
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==
graphql@16.5.0:
version "16.5.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.5.0.tgz#41b5c1182eaac7f3d47164fb247f61e4dfb69c85"
integrity sha512-qbHgh8Ix+j/qY+a/ZcJnFQ+j8ezakqPiHwPiZhV/3PgGlgf96QMBB5/f2rkiC9sgLoy/xvT6TSiaf2nTHJh5iA==
gray-matter@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798"