-
Notifications
You must be signed in to change notification settings - Fork 28
/
craco.config.js
36 lines (35 loc) · 1.14 KB
/
craco.config.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
const { when } = require('@craco/craco');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const webpack = require('webpack');
module.exports = {
webpack: {
configure: {
resolve: {
fallback: {
fs: false,
assert: require.resolve('assert'),
buffer: require.resolve('buffer'),
path: require.resolve('path-browserify'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
process: require.resolve('process/browser'),
stream: require.resolve('stream-browserify'),
zlib: require.resolve('browserify-zlib'),
util: require.resolve('util'),
url: require.resolve('url'),
},
},
},
plugins: {
add: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: require.resolve('process/browser'),
}),
...when(Boolean(process.env.ANALYZE), () => [new BundleAnalyzerPlugin()], []),
],
},
},
};