-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-node.js
55 lines (46 loc) · 1.31 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
46
47
48
49
50
51
52
53
54
55
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// You can delete this file if you're not using it
// gatsby-node.js
// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
// exports.onCreateWebpackConfig = ({ actions }) => {
// actions.setWebpackConfig({
// node: { fs: 'empty' },
// })
// }
// exports.onCreatePage = async ({ page, actions }) => {
// const { createPage, deletePage } = actions
// // Check if the page is a localized 404
// if (page.path.startsWith('/404')) {
// page.layout = '404.index';
// }
// }
exports.onCreateWebpackConfig = helper => {
const { stage, actions, getConfig } = helper
// if (stage === "build-html") {
// actions.setWebpackConfig({
// module: {
// rules: [
// {
// test: /@firebase/,
// use: loaders.null(),
// },
// ],
// },
// })
// }
if (stage === "develop" || 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)
}
}