-
Notifications
You must be signed in to change notification settings - Fork 63
/
gatsby-node.js
41 lines (36 loc) · 976 Bytes
/
gatsby-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
const path = require('path')
require('source-map-support').install()
require('ts-node').register({
compilerOptions: {
module: 'commonjs',
target: 'es2017',
},
})
exports.createPages = require('./gatsby-create-pages').createPages
exports.onCreateWebpackConfig = ({ actions }) => {
// lets us import components into mdx files
// https://github.com/ChristopherBiscardi/gatsby-mdx/issues/176#issuecomment-429569578
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
})
}
exports.createSchemaCustomization = ({ actions, schema }) => {
const { createTypes } = actions
createTypes(`
type Mdx implements Node {
frontmatter: MdxFrontmatter
}
type MdxFrontmatter {
author: AuthorJson @link(from: "author" by:"username")
}
type AuthorJson implements Node {
id: ID!
username: String!
name: String!
title: String!
}`
)
}