Skip to content

Commit 599419e

Browse files
committed
Don't let webpack bundle node-libs-browser
Dependencies pulled in by `require('crypto')` account for several hundred kb of vendors.bundle.js. https://medium.com/walmartlabs/webpack-optimization-a-case-study-92b130334b6c webpack/webpack.js.org#1317
1 parent 44bba54 commit 599419e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

config/webpack.common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ module.exports = {
7373
extensions: ['.js'],
7474
},
7575
node: {
76+
crypto: 'empty',
7677
fs: 'empty',
77-
dns: 'empty',
78+
path: 'empty',
79+
process: false,
7880
},
7981
};

config/webpack.prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = merge(common, {
4949
// recommendation of 250kb, but are combined with 'error' to ensure that
5050
// they don't grow accidentally beyond the current size.
5151
hints: 'error',
52-
maxAssetSize: 1.45*1024*1024,
53-
maxEntrypointSize: 2.13*1024*1024,
52+
maxAssetSize: 1.1*1024*1024,
53+
maxEntrypointSize: 1.8*1024*1024,
5454
},
5555
});

0 commit comments

Comments
 (0)