forked from TryGhost/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
46 lines (35 loc) · 1.2 KB
/
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
45
const createPages = require(`./gatsby/createPages`)
const onCreateNode = require(`./gatsby/onCreateNode`)
exports.createPages = ({ graphql, actions }) => Promise.all([
createPages.createRedirects({ actions }),
createPages.createMarkdownPages({ graphql, actions }),
createPages.createNewsIndexPages({ graphql, actions }),
])
exports.onCreateNode = async ({ node, getNode, actions, loadNodeContent }) => {
await onCreateNode.createJupyterNoteBookNodes(({ node, getNode, actions, loadNodeContent }));
await onCreateNode.createMarkdownNodeFields(({ node, getNode, actions }));
}
const express = require(`express`)
// Enable development support for serving HTML from `./static` folder
exports.onCreateDevServer = ({ app }) => {
app.use(express.static(`public`))
}
exports.onCreateWebpackConfig = ({ actions, stage, plugins }) => {
actions.setWebpackConfig({
resolve: {
alias: {
path: require.resolve("path-browserify")
},
fallback: {
fs: false,
}
}
})
if (stage === 'build-javascript' || stage === 'develop') {
actions.setWebpackConfig({
plugins: [
plugins.provide({ process: 'process/browser' })
]
})
}
}