-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.config.js
47 lines (45 loc) · 1.38 KB
/
static.config.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
45
46
47
import path from 'path';
import gqlClient from './src/utils/gqlClient';
import { GET_ALL_PRODUCTS } from './src/utils/gqlQuery';
export default {
entry: path.join(__dirname, 'src', 'index.tsx'),
getRoutes: async () => {
const {data: { products }} = await gqlClient.query({
query: GET_ALL_PRODUCTS,
fetchPolicy: 'no-cache'
});
return [
{
path: '/',
getData: () => ({
products
})
},
{
path: '/shop',
getData: () => ({
products,
}),
children: products.edges.map((product) => ({
path: `/product/${product.node.handle}`,
template: 'src/pages/product',
getData: () => ({
product: product.node
}),
}))
},
]
},
plugins: [
'react-static-plugin-typescript',
[
require.resolve('react-static-plugin-source-filesystem'),
{
location: path.resolve('./src/pages'),
},
],
require.resolve('react-static-plugin-reach-router'),
require.resolve('react-static-plugin-sitemap'),
require.resolve('react-static-plugin-sass'),
],
}