-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
44 lines (40 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
42
43
44
const webpack = require('webpack');
module.exports = function override(config) {
config.target = "web";
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"util": require.resolve("util/"),
"url": require.resolve("url/"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"crypto": require.resolve("crypto-browserify"),
"buffer": require.resolve("buffer/"),
})
config.resolve.fallback = fallback;
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
})
]);
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: 'file-loader',
options: {
name: 'images/[hash]-[name].[ext]',
},
},
],
});
config.module.rules.push({
test: /\.m?js/,
resolve: {
fullySpecified: false
}
});
return config;
}