manifold/web/next.config.js
joy_void_joy 2e5ea40953 chore: Add ability to import .graphql files
Change next-js config to be able to write

```
import typeDefs from './schema.graphql'
```
2022-07-20 13:47:43 +02:00

58 lines
1.3 KiB
JavaScript

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,
experimental: {
externalDir: true,
optimizeCss: true,
modularizeImports: {
'@heroicons/react/solid/?(((\\w*)?/?)*)': {
transform: '@heroicons/react/solid/{{ matches.[1] }}/{{member}}',
},
'@heroicons/react/outline/?(((\\w*)?/?)*)': {
transform: '@heroicons/react/outline/{{ matches.[1] }}/{{member}}',
},
lodash: {
transform: 'lodash/{{member}}',
},
},
},
images: {
domains: ['lh3.googleusercontent.com', 'i.imgur.com'],
},
async redirects() {
return [
{
source: '/api',
destination: API_DOCS_URL,
permanent: false,
},
{
source: '/api/v0',
destination: API_DOCS_URL,
permanent: false,
},
{
source: '/analytics',
destination: '/stats',
permanent: true,
},
]
},
}