-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
69 lines (67 loc) · 2.13 KB
/
config-overrides.js
File metadata and controls
69 lines (67 loc) · 2.13 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* eslint-disable no-undef */
const { override, addBabelPlugin, useBabelRc, addWebpackPlugin, addWebpackModuleRule } = require("customize-cra");
const ProgressBarPlugin = require("progress-bar-webpack-plugin");
const rewiredMap = () => (config) => {
config.devtool = config.mode === "development" ? "cheap-module-source-map" : false;
config.externals = {
'nostr-tools': 'NostrTools'
}
if (config.mode !== "development") {
config.devtool = false;
/* invade(config.optimization.minimizer, "TerserPlugin", (e) => {
e.options.extractComments = false;
e.options.minimizer.options.compress.drop_console = true;
e.options.minimizer.options.compress.drop_debugger = true;
}); */
config.optimization.runtimeChunk = "single";
config.optimization.splitChunks = {
chunks: "all",
minChunks: 1,
maxSize: 1000000,
cacheGroups: {
baseChunks: {
name: "base.chunks",
test: (module) => /react|react-dom|react-router-dom/.test(module.context),
priority: 30
},
libChunks: {
name: "lib.chunks",
test: (module) =>
/react-redux|redux|axios|dayjs|lodash|lockr|bignumber|classnames|buffer|lingui|EventEmitter|ahooks|immer|md5|sass|viem/.test(
module.context
),
priority: 20
},
web3Chunks: {
name: "web3.chunks",
test: (module) => /wagmi|providers|units|ethersproject|ethers|graphql|urql|nostr-tools/.test(module.context),
priority: 15
},
uiChunks: {
name: "ui.chunks",
test: (module) => /antd|@ant-design\/icons|echarts|emoji-mart/.test(module.context),
priority: 10
},
default: {
name: "common.chunks",
minChunks: 2,
priority: 5,
reuseExistingChunk: true
}
}
};
}
return config;
};
module.exports = override(
// eslint-disable-next-line react-hooks/rules-of-hooks
useBabelRc(),
rewiredMap(),
addWebpackModuleRule({
test: /\.po$/,
use: { loader: "@lingui/loader" }
}),
addWebpackPlugin(
new ProgressBarPlugin()
)
);