-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcraco.config.js
62 lines (58 loc) · 1.57 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
const webpack = require('webpack');
const CracoLessPlugin = require('craco-less');
module.exports = {
babel: {
plugins: ['preval', 'macros']
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@primary-color': '#8D78F7',
'@link-color': '#8D78F7',
'@success-color': '#82CB7C',
'@warning-color': '#FFA24E',
'@error-color': '#EB6A5D',
'@font-size-base': '16px',
'@border-radius-base': '10px'
},
javascriptEnabled: true,
},
},
},
},
],
webpack: {
configure: (config) => {
const rules = config.module.rules
.find((rule) => typeof rule.oneOf === 'object')
.oneOf.filter((rule) => Array.isArray(rule.use));
rules.forEach((rule) => {
rule.use.forEach((moduleLoader) => {
if (moduleLoader?.loader?.includes('resolve-url-loader'))
moduleLoader.options.sourceMap = false;
});
});
config.resolve = {
...config.resolve,
fallback: {
buffer: require.resolve('buffer'),
stream: require.resolve("stream-browserify")
}
};
// To disable webpack cache of node_modules when debug
config.cache.buildDependencies.mydeps = ['./webpackBuildCache.lock'];
return config;
},
plugins: {
add: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
},
}
};