-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathgatsby-node.js
More file actions
32 lines (30 loc) · 858 Bytes
/
gatsby-node.js
File metadata and controls
32 lines (30 loc) · 858 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
27
28
29
30
31
32
const { createFilePath } = require("gatsby-source-filesystem");
// Here we're adding extra stuff to the "node" (like the slug)
// so we can query later for all blogs and get their slug
exports.onCreateNode = ({ node, actions, getNode }) => {
const { createNodeField } = actions;
if (node.internal.type === "Mdx") {
createNodeField({
// Individual MDX node
node,
// Name of the field you are adding
name: "slug",
// Generated value
value: createFilePath({ node, getNode })
});
}
};
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
if (stage === "build-html" || stage === "develop-html") {
actions.setWebpackConfig({
module: {
rules: [
{
test: /chartjs-plugin-dragdata/,
use: loaders.null()
}
]
}
});
}
};