-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcraco.config.js
63 lines (62 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
61
62
63
/* eslint-disable @typescript-eslint/no-var-requires */
const WebpackBar = require("webpackbar");
const CracoAntDesignPlugin = require("craco-antd");
const CracoLessPlugin = require("craco-less");
const path = require("path");
const getCSSModuleLocalIdent = require("react-dev-utils/getCSSModuleLocalIdent"); // included in Create React App
module.exports = {
webpack: {
entry: ["babel-polyfill", "./src/client/index.tsx"],
plugins: [new WebpackBar({ profile: true })],
},
devServer: {
port: 3000,
open: true,
hot: true,
proxy: {
"/api/**": {
target: "http://localhost:8050",
secure: false,
changeOrigin: true,
},
},
},
plugins: [
{
plugin: CracoAntDesignPlugin,
options: {
customizeThemeLessPath: path.join(__dirname, "src/less/variables.less"),
},
},
{
plugin: CracoLessPlugin,
options: {
cssLoaderOptions: {
modules: {
getLocalIdent: (context, localIdentName, localName, options) => {
if (context.resourcePath.includes("node_modules")) {
return localName;
}
return getCSSModuleLocalIdent(
context,
localIdentName,
localName,
options
);
},
},
},
lessLoaderOptions: {
lessOptions: {
javascriptEnabled: true,
},
},
modifyLessRule: (lessRule, _context) => {
lessRule.test = /\.(module)\.(less)$/;
lessRule.exclude = path.join(__dirname, "node_modules");
return lessRule;
},
},
},
],
};