generated from gatsbyjs/gatsby-starter-default
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gatsby-node.js
48 lines (44 loc) · 1.55 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
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.com/docs/node-apis/
*/
const path = require('path')
exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
actions.setWebpackConfig({
resolve: {
alias: {
'~components': path.resolve(__dirname, 'src/components'),
'~containers': path.resolve(__dirname, 'src/containers'),
'~contexts': path.resolve(__dirname, 'src/contexts'),
'~pages': path.resolve(__dirname, 'src/pages'),
'~hooks': path.resolve(__dirname, 'src/hooks'),
'~styles': path.resolve(__dirname, 'src/styles'),
'~img': path.resolve(__dirname, 'src/assets/img'),
'~fonts': path.resolve(__dirname, 'src/assets/fonts'),
'~images': path.resolve(__dirname, 'src/images'),
'~utils': path.resolve(__dirname, 'src/utils'),
'~routes': path.resolve(__dirname, 'src/routes.js'),
},
},
})
/* Set ignoreOrder: true to remove warnings when using css modules */
const config = getConfig()
const miniCssExtractPlugin = config.plugins.find(
(plugin) => plugin.constructor.name === 'MiniCssExtractPlugin'
)
if (miniCssExtractPlugin) {
miniCssExtractPlugin.options.ignoreOrder = true
}
actions.replaceWebpackConfig(config)
}
if (process.env.NODE_ENV === `development`) {
exports.createPages = async ({ actions }) => {
const { createPage } = actions
const productTemplate = path.resolve(`src/templates/SVGPreview/index.jsx`)
createPage({
path: `/___svg`,
component: productTemplate,
})
}
}