-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
38 lines (34 loc) · 1003 Bytes
/
Copy pathconfig-overrides.js
File metadata and controls
38 lines (34 loc) · 1003 Bytes
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
/**
* This file prevents webpack from adding hashes to filenames
*/
const { override, adjustStyleLoaders } = require("customize-cra");
module.exports = override((config) => {
if (config.output) {
config.output.filename = "static/js/[name].js";
config.output.chunkFilename = "static/js/[name].chunk.js";
}
// Adjust output filenames for CSS
config.plugins.forEach((plugin) => {
if (plugin.constructor.name === "MiniCssExtractPlugin") {
plugin.options.filename = "static/css/[name].css";
plugin.options.chunkFilename = "static/css/[name].chunk.css";
}
});
return config;
},
// Ensure CSS is processed correctly
adjustStyleLoaders((rule) => {
if (rule.test && String(rule.test).includes("css")) {
if (rule.use) {
rule.use.forEach((loader) => {
if (
loader.loader &&
loader.loader.includes("css-loader")
) {
loader.options = {
...loader.options };
}
});
}
}
}));