-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.esm.js
36 lines (32 loc) · 1 KB
/
gatsby-node.esm.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
import webpack from 'webpack'
import {
getIsProductionBuild,
getIsRuntimeBuild,
} from './src/utils/server'
import pages from './src/utils/gatsby/pages'
export const createPages = ({ actions }) => {
pages.forEach(page => {
actions.createPage({
...page,
component: require.resolve('./src/containers/Page/index.jsx'),
})
})
}
export const onCreateWebpackConfig = ({ actions }) => {
// Get primitive value of current date and time.
const buildDateTime = new Date().valueOf()
actions.setWebpackConfig({
plugins: [
// Define global constant at compile time.
new webpack.DefinePlugin({
BUILD_DATE_TIME: buildDateTime,
IS_RUNTIME: getIsRuntimeBuild(),
IS_PRODUCTION: getIsProductionBuild(),
}),
],
resolve: {
// Import from files without specifying extensions.
extensions: ['.js', '.jsx', '.scss', '.svg'],
},
})
}