-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.ts
34 lines (30 loc) · 870 Bytes
/
gatsby-node.ts
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
import { GatsbyNode } from 'gatsby'
import { RelativeCiAgentWebpackPlugin } from '@relative-ci/agent'
import graphQLTypes from './src/types/graphql'
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = ({
stage,
actions,
}) => {
if (stage === 'build-javascript') {
actions.setWebpackConfig({
plugins: [
new RelativeCiAgentWebpackPlugin({
enabled: process.env.NODE_ENV === 'production' && !!process.env.RELATIVE_CI,
}),
],
})
}
}
export const onCreateBabelConfig: GatsbyNode['onCreateBabelConfig'] = ({ actions }) => {
actions.setBabelPlugin({
name: '@babel/plugin-transform-react-jsx',
options: {
runtime: 'automatic',
},
})
}
export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] = ({
actions,
}) => {
actions.createTypes(graphQLTypes)
}