-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
35 lines (27 loc) · 1.05 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
const webpack = require('webpack');
const { aliasDangerous } = require('react-app-rewire-alias/lib/aliasDangerous');
module.exports = function override(config, env) {
//do stuff with the webpack config...
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: require.resolve('crypto-browserify'),
});
config.resolve.fallback = fallback;
// REACT_ APP_ NODE_ ENV is set in Tonomy-Integration/scripts/helpers.sh
if (process.env.REACT_APP_NODE_ENV === 'local') {
// https://github.com/risenforces/craco-alias/issues/24#issuecomment-801176626
console.log('Local environment detected, using local Tonomy-ID-SDK');
const aliasConfigModifier = aliasDangerous({
'tonomy-id-sdk': __dirname + '/../Tonomy-ID-SDK',
});
aliasConfigModifier(config);
}
config.plugins = [
...config.plugins,
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
];
return config;
};