-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
Copy pathgatsby-node.js
43 lines (38 loc) · 915 Bytes
/
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
const webpackLodashPlugin = require(`lodash-webpack-plugin`)
// Add Lodash webpack plugin
exports.onCreateWebpackConfig = (
{ actions, stage },
{ disabledFeatures = [] }
) => {
if (stage !== `build-javascript`) return
const features = {
shorthands: true,
cloning: true,
currying: true,
caching: true,
collections: true,
exotics: true,
guards: true,
metadata: true,
deburring: true,
unicode: true,
chaining: true,
memoizing: true,
coercions: true,
flattening: true,
paths: true,
placeholders: true,
}
disabledFeatures.forEach(feature => {
delete features[feature]
})
actions.setWebpackConfig({
plugins: [new webpackLodashPlugin(features)],
})
}
// Add Lodash Babel plugin
exports.onCreateBabelConfig = ({ actions }) => {
actions.setBabelPlugin({
name: require.resolve(`@sigmacomputing/babel-plugin-lodash`),
})
}