-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgatsby-node.js
More file actions
76 lines (73 loc) · 2.32 KB
/
Copy pathgatsby-node.js
File metadata and controls
76 lines (73 loc) · 2.32 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
if (stage === 'build-javascript') {
const config = getConfig();
const miniCssExtractPlugin = config.plugins.find(
(plugin) => plugin.constructor.name === 'MiniCssExtractPlugin',
);
if (miniCssExtractPlugin) {
miniCssExtractPlugin.options.ignoreOrder = true;
}
actions.replaceWebpackConfig(config);
}
};
// const Promise = require('bluebird');
// const path = require('path');
// exports.createPages = ({ graphql, actions }) => {
// const { createPage } = actions;
//
// return new Promise((resolve, reject) => {
// const blogPost = path.resolve('./src/templates/blog-post.js');
// const hackathonTemplate = path.resolve('./src/templates/hackathon/hackathon.jsx');
// resolve(
// graphql(
// `
// {
// allContentfulBlogPost {
// edges {
// node {
// title
// slug
// }
// }
// }
// }
// `,
// ).then((result) => {
// if (result.errors) {
// console.log(result.errors);
// reject(result.errors);
// }
//
// const posts = result.data.allContentfulBlogPost.edges;
// posts.forEach((post, index) => {
// createPage({
// path: `/blog/${post.node.slug}/`,
// components: blogPost,
// context: {
// slug: post.node.slug,
// },
// });
// });
//
// createPage({
// path: '/events/htm-5',
// components: hackathonTemplate,
// });
// }),
// );
// });
// };
exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
if (stage === 'build-html') {
actions.setWebpackConfig({
module: {
rules: [
{
test: /masonry-layout/,
use: loaders.null(),
},
],
},
});
}
};