forked from opengoofy/hippo4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
60 lines (57 loc) · 1.67 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
const CracoLessPlugin = require('craco-less');
const lessModuleRegex = /\.module\.less$/;
const path = require('path');
const basePath = path.resolve(__dirname, '.');
const resolve = dir => path.resolve(basePath, dir);
module.exports = {
plugins: [
{
plugin: CracoLessPlugin,
options: {
// less loader options
lessLoaderOptions: {
lessOptions: {
// modifyVars: { "@primary-color": "#1DA57A" },
javascriptEnabled: true,
},
},
// A callback function that receives two arguments: the webpack rule,
// and the context. You must return an updated rule object.
modifyLessRule: lessRule => {
lessRule.test = lessModuleRegex;
lessRule.exclude = /node_modules|antd\.css/;
return lessRule;
},
// Passing an options object to configure the css-loaders
cssLoaderOptions: {
modules: { localIdentName: '[local]_[hash:base64:5]' },
},
},
},
],
webpack: {
alias: {
'@': resolve('src'),
},
},
devServer: {
port: 3000,
headers: {
'Access-Control-Allow-Origin': '*',
},
proxy: {
'/hippo4j/v1/cs': {
target: 'http://console.hippo4j.cn:6691/hippo4j/v1/cs',
pathRewrite: { '^/hippo4j/v1/cs': '' },
changeOrigin: true,
secure: false,
onProxyReq: proxyReq => {
console.log(`Proxying request to: ${proxyReq.path}`);
},
onProxyRes: proxyRes => {
console.log(`Received response with status: ${proxyRes.statusCode}`);
},
},
},
},
};