-
Notifications
You must be signed in to change notification settings - Fork 17
/
gatsby-node.ts
34 lines (30 loc) · 1 KB
/
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
32
33
34
import { GatsbyNode } from "gatsby"
import { news } from "./src/data/news"
import { clients } from "./src/data/clients"
import { lectures } from "./src/data/lectures"
import * as fs from "fs"
export const onPostBuild: GatsbyNode["onPostBuild"] = () => {
const clientsJson = JSON.stringify(clients, undefined, 2)
fs.writeFileSync("./public/clients/json", clientsJson)
fs.writeFileSync("./public/clients.json", clientsJson)
const newsJson = JSON.stringify(news, undefined, 2)
fs.writeFileSync("./public/news/json", newsJson)
fs.writeFileSync("./public/news.json", newsJson)
const lecturesJson = JSON.stringify(lectures, undefined, 2)
fs.writeFileSync("./public/lectures/json", lecturesJson)
fs.writeFileSync("./public/lectures.json", lecturesJson)
}
export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
actions,
}) => {
actions.setWebpackConfig({
module: {
rules: [
{
test: /\.node$/,
use: ["node-loader"],
},
],
},
})
}