generated from vtex-sites/base.store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-node.js
44 lines (41 loc) · 968 Bytes
/
gatsby-node.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
37
38
39
40
41
42
43
44
exports.onCreateWebpackConfig = ({ actions: { setWebpackConfig }, stage }) => {
const profiling = process.env.GATSBY_STORE_PROFILING
if (stage === 'build-javascript' && profiling === true) {
setWebpackConfig({
optimization: {
minimize: false,
moduleIds: 'named',
chunkIds: 'named',
concatenateModules: false,
},
})
}
}
exports.onCreatePage = async (args) => {
const {
page,
actions: { createPage, deletePage },
} = args
/**
* Adds context to home page
*/
if (
page.path === '/' ||
(page.context !== undefined &&
typeof page.context.originalPath === 'string' &&
page.context.originalPath === '/')
) {
// Add context to home page
deletePage(page)
createPage({
...page,
context: {
from: 0,
to: 3,
collection: '143',
orderBy: 'OrderByBestDiscountDESC',
hideUnavailableItems: true,
},
})
}
}