forked from yours-org/yours-wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
41 lines (38 loc) · 1.06 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
31
32
33
34
35
36
37
38
39
40
41
const webpack = require('webpack');
const WebpackPluginReplaceNpm = require('replace-module-webpack-plugin');
module.exports = function override(config, env) {
// Ensure crypto-browserify is used as a fallback for the crypto module
config.resolve.fallback = {
...config.resolve.fallback,
crypto: require.resolve('crypto-browserify'),
util: require.resolve('util'),
assert: require.resolve('assert'),
url: require.resolve('url'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
process: require.resolve('process'),
fs: false,
os: false,
};
// Define plugins
config.plugins = [
...config.plugins,
new WebpackPluginReplaceNpm({
rules: [
{
originModule: 'path',
replaceModule: 'path-browserify',
},
{
originModule: 'bsv-wasm',
replaceModule: 'bsv-wasm-web',
},
],
}),
new webpack.ProvidePlugin({
process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'],
}),
];
return config;
};