forked from PostHog/posthog.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.ts
41 lines (38 loc) · 1.6 KB
/
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
35
36
37
38
39
40
41
import path from 'path'
import { GatsbyNode } from 'gatsby'
export { createPages } from './gatsby/createPages'
export { onCreateNode, onPreInit } from './gatsby/onCreateNode'
export { createSchemaCustomization } from './gatsby/createSchemaCustomization'
export { sourceNodes } from './gatsby/sourceNodes'
export { onPostBuild } from './gatsby/onPostBuild'
export { createResolvers } from './gatsby/createResolvers'
export { onPreBootstrap } from './gatsby/onPreBootstrap'
// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
export const onCreatePage: GatsbyNode['onCreatePage'] = async ({ page, actions }) => {
const { createPage } = actions
if (page.path.match(/^\/community\/profiles/)) {
page.matchPath = '/community/profiles/*'
createPage(page)
}
if (page.path.match(/^\/next\-steps/)) {
page.matchPath = '/next-steps/*'
createPage(page)
}
}
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = ({ stage, actions }) => {
actions.setWebpackConfig({
resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
'~': path.resolve(__dirname, 'src'),
lib: path.resolve(__dirname, 'src', 'lib'),
types: path.resolve(__dirname, 'src', 'types'),
images: path.resolve(__dirname, 'src', 'images'),
components: path.resolve(__dirname, 'src', 'components'),
logic: path.resolve(__dirname, 'src', 'logic'),
hooks: path.resolve(__dirname, 'src', 'hooks'),
},
},
})
}