-
Notifications
You must be signed in to change notification settings - Fork 1
/
craco.config.js
101 lines (94 loc) · 3.66 KB
/
craco.config.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
craco.config.js
const path = require('path');
const iconset = {
bimi: 'IMIIcons',
bimi_dev_user: 'IMIIcons',
bimi_agile: 'IMIIcons',
bimi_agile_dev_user: 'IMIIcons',
newb2b: 'MWDefaultIcons',
marketwall: 'MWDefaultIcons',
marketwall_dev_user: 'MWDefaultIcons',
tv: 'MWDefaultIcons',
};
const routingTypes = {
bimi: 'hashAPI',
bimi_dev_user: 'hashAPI',
bimi_agile: 'hashAPI',
bimi_agile_dev_user: 'hashAPI',
newb2b: 'html5API',
marketwall: 'html5API',
marketwall_dev_user: 'html5API',
tv: 'html5API',
};
const storeTypes = {
bimi: 'emptyStore',
bimi_dev_user: 'emptyStore',
bimi_agile: 'emptyStore',
bimi_agile_dev_user: 'emptyStore',
newb2b: 'b2b',
marketwall: 'emptyStore',
marketwall_dev_user: 'emptyStore',
tv: 'emptyStore',
};
const menuLocationTypes = {
bimi: 'MenuToLocationConnector',
bimi_dev_user: 'MenuToLocationConnector',
bimi_agile: 'MenuToLocationConnector',
bimi_agile_dev_user: 'MenuToLocationConnector',
newb2b: 'MenuToLocationConnectorNewRouting',
marketwall: 'MenuToLocationConnectorNewRouting',
marketwall_dev_user: 'MenuToLocationConnectorNewRouting',
tv: 'MenuToLocationConnectorNewRouting',
};
module.exports = function () {
return {
webpack: {
alias: {
// store: path.join(__dirname, 'src', 'redux', storeTypes[process.env.APPLICATION_TYPE], 'store'),
// configurations: path.join(__dirname, 'src', 'globalConfig', 'applicationTypes', process.env.APPLICATION_TYPE, 'index'),
// routing: path.join(__dirname, 'src', 'providers', 'routingProvider', routingTypes[process.env.APPLICATION_TYPE]),
// 'menu-to-location-connector': path.join(__dirname, 'src', 'components', 'organisms', 'Menu', 'dojo', menuLocationTypes[process.env.APPLICATION_TYPE]),
// icons: path.join(__dirname, 'src', 'components', 'organisms', 'MWIcon', 'iconset', iconset[process.env.APPLICATION_TYPE])
},
configure: (webpackConfig) => {
// !!! DANGER !!!
// If webpack config of create-react-app will change - this config may fail!
// it assumes that in webpackConfig.module.rules[3].oneOf are listed
// all the rules, and it adds specific procession for svg files, similar
// to the one in webpack.config.js
const rulesArray = webpackConfig.module.rules[3].oneOf;
rulesArray.unshift({
test: /\.react\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: {
prefixIds: false,
},
},
},
},
],
});
rulesArray.unshift({
test: /\.svg$/,
exclude: /\.react\.svg$/,
use: [
{
loader: 'svg-url-loader',
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
});
rulesArray[rulesArray.length - 1].exclude.push(/\.svg$/);
// END OF RULES MODIFICATION
return webpackConfig;
}
},
};
};