-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathconfig-overrides.js
30 lines (27 loc) · 1.03 KB
/
config-overrides.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
const webpack = require('webpack');
module.exports = function override(config, env) {
// Add fallback for node modules
config.resolve.fallback = {
...config.resolve.fallback,
process: require.resolve('process/browser'),
zlib: require.resolve('browserify-zlib'),
stream: require.resolve('stream-browserify'),
util: require.resolve('util/'),
buffer: require.resolve('buffer/'),
asset: require.resolve('assert/'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
path: require.resolve('path-browserify'),
url: require.resolve('url/')
};
// Add ProvidePlugin to make node modules available globally
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
]);
return config;
};