forked from lolipopshock/label-studio-frontend
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config-overrides.js
35 lines (32 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
module.exports = function override(config, env) {
if (process.env.BUILD_NO_MINIMIZATION) {
config.optimization.minimizer = undefined;
const rules = config.module.rules.find(rule => rule.oneOf);
if (rules) {
const jsRule = rules.oneOf.find(rule => String(rule.test).includes("jsx"));
if (jsRule) {
const options = jsRule.options;
options.compact = false;
options.cacheCompression = false;
}
}
}
if (process.env.BUILD_NO_CHUNKS) {
config.optimization.runtimeChunk = false;
config.optimization.splitChunks = {
cacheGroups: {
default: false,
},
};
}
if (process.env.BUILD_NO_HASH) {
config.output.filename = "static/js/[name].js";
config.output.chunkFilename = "static/js/[name].chunk.js";
const CssPlugin = config.plugins.find(p => p.constructor.name.includes("Css"));
if (CssPlugin) {
CssPlugin.options.filename = "static/css/[name].css";
CssPlugin.options.chunkFilename = "static/css/[name].[contenthash:8].chunk.css";
}
}
return config;
};