forked from primer/presentations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgatsby-node.js
More file actions
23 lines (20 loc) · 746 Bytes
/
gatsby-node.js
File metadata and controls
23 lines (20 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const defines = require('./babel-defines')
exports.onCreateWebpackConfig = ({actions, plugins, getConfig}) => {
const config = getConfig()
// Add our `__DEV__` and `process.env.NODE_ENV` defines
config.plugins.push(plugins.define(defines[process.env.NODE_ENV || 'development']))
// Polyfill `path` and stub `fs` for use in the browser
// https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#webpack-5-node-configuration-changed-nodefs-nodepath-
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
path: require.resolve('path-browserify'),
},
fallback: {
...config.resolve.fallback,
fs: false,
},
}
actions.replaceWebpackConfig(config)
}