-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathgatsby-node.js
More file actions
26 lines (24 loc) · 907 Bytes
/
gatsby-node.js
File metadata and controls
26 lines (24 loc) · 907 Bytes
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
const redirects = require('./redirects')
exports.createPages = ({actions: {createRedirect}}) => {
for (const [fromPath, toPath] of Object.entries(redirects)) {
// console.warn(`[redirect] ${fromPath} → ${toPath}`)
createRedirect({fromPath, toPath, redirectInBrowser: true})
}
}
exports.onCreateWebpackConfig = ({stage, loaders, actions}) => {
if (stage === 'build-html' || stage === 'develop-html') {
actions.setWebpackConfig({
module: {
rules: [
{
// Ignore "@github\/markdown-toolbar-element" module during server-side rendering
// because it uses DOM APIs that aren't available on the server.
// Copied from https://www.gatsbyjs.com/docs/debugging-html-builds/#fixing-third-party-modules
test: /@github\/markdown-toolbar-element/,
use: loaders.null(),
},
],
},
})
}
}