forked from yb/uptime-status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
39 lines (34 loc) · 939 Bytes
/
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
const removePlugin = (plugins, name) => {
const index = plugins.findIndex((plugin) => {
return plugin.constructor && plugin.constructor.name && plugin.constructor.name === name;
});
if (index === -1) return plugins;
return plugins.slice(0, index).concat(plugins.slice(index + 1));
}
const svgLoader = (rule) => {
if (rule.oneOf instanceof Array) {
return {
...rule,
oneOf: [
{
test: [/\.svg$/],
loader: require.resolve('url-loader'),
},
...rule.oneOf
]
}
}
return rule;
}
module.exports = (config) => {
config.optimization.runtimeChunk = false;
config.optimization.splitChunks = {
cacheGroups: {
default: false
}
};
config.plugins = removePlugin(config.plugins, 'ManifestPlugin');
config.plugins = removePlugin(config.plugins, 'GenerateSW');
config.module.rules = config.module.rules.map(svgLoader);
return config;
}