-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.ts
31 lines (27 loc) · 966 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
import path from 'path'
import { createPages } from './gatsby/create-pages'
import type { CreateWebpackConfigArgs } from 'gatsby'
const BASE_URL = './src'
const getPath = (customPath: string) =>
path.resolve(__dirname, `${BASE_URL}${customPath}`)
exports.onCreateWebpackConfig = ({ actions }: CreateWebpackConfigArgs) => {
actions.setWebpackConfig({
resolve: {
alias: {
'~/components/*': getPath('/components/*'),
'~/components': getPath('/components'),
'~/constants/*': getPath('/constants/*'),
'~/constants': getPath('/constants'),
'~/hooks/*': getPath('/hooks/*'),
'~/hooks': getPath('/hooks'),
'~/layout/*': getPath('/layout/*'),
'~/layout': getPath('/layout'),
'~/styles/*': getPath('/styles/*'),
'~/styles': getPath('/styles'),
'~/utils/*': getPath('/utils/*'),
'~/utils': getPath('/utils')
}
}
})
}
exports.createPages = createPages