-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgatsby-node.ts
28 lines (24 loc) · 982 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
import path from 'path'
import * as gatsbyNode from './src/gatsby-node'
import type { CreateWebpackConfigArgs, GatsbyNode } from 'gatsby'
export const onCreateNode: GatsbyNode['onCreateNode'] = gatsbyNode.onCreateNode
export const createPages: GatsbyNode['createPages'] = gatsbyNode.createPages
export const createSchemaCustomization: GatsbyNode['createSchemaCustomization'] = gatsbyNode.createSchemaCustomization
export const onCreateWebpackConfig = ({ actions }: CreateWebpackConfigArgs) => {
actions.setWebpackConfig({
resolve: {
alias: {
'@Components': path.resolve('src/components'),
'@Constants': path.resolve('src/constants'),
'@Context': path.resolve('src/context'),
'@Lib': path.resolve('src/lib'),
},
},
})
// Gatsbyではビルド時には常にNODE_ENV=productionになるため、ブランチで判定
if (process.env.BRANCH === 'main') {
actions.setWebpackConfig({
devtool: false,
})
}
}