-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
96 lines (95 loc) · 2.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
const path = require("path");
const CracoLessPlugin = require("craco-less");
const SimpleProgressWebpackPlugin = require("simple-progress-webpack-plugin");
module.exports = {
webpack: {
module: {
rules: [
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "babel-loader",
},
{
loader: "@svgr/webpack",
options: {
babel: false,
icon: true,
},
},
],
},
],
},
// 别名
alias: {
"@": path.resolve("src"),
"@api": path.resolve("src/api"),
"@assets": path.resolve("src/assets"),
"@components": path.resolve("src/components"),
"@css": path.resolve("src/css"),
"@routes": path.resolve("src/routes"),
"@utils": path.resolve("src/utils"),
"@views": path.resolve("src/views"),
},
plugins: [
// 查看打包的进度
new SimpleProgressWebpackPlugin(),
],
},
babel: {
plugins: [
["@babel/plugin-proposal-decorators", { legacy: true }],
[
"import",
{
libraryName: "antd",
libraryDirectory: "es",
style: true, //设置为true即是less
},
],
],
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
"@primary-color": "#34B4AC", // 全局主色
"@link-color": "#34B4AC", // 链接色
"@success-color": "#52c41a", // 成功色
"@warning-color": "#faad14", // 警告色
"@error-color": "#f5222d", // 错误色
"@font-size-base": "14px", // 主字号
"@heading-color": "rgba(0, 0, 0, 0.85)", // 标题色
"@text-color": "rgba(0, 0, 0, 0.65)", // 主文本色
"@text-color-secondary": "rgba(0, 0, 0, 0.45)", // 次文本色
"@disabled-color": "rgba(0, 0, 0, 0.25)", // 失效色
"@border-radius-base": "4px", // 组件/浮层圆角
"@border-color-base": "#d9d9d9", // 边框色
"@box-shadow-base": "0 2px 8px rgba(0, 0, 0, 0.15)", // 浮层阴影
},
javascriptEnabled: true,
},
},
},
},
],
devServer: {
port: 3000,
compress: false,
proxy: {
"/myriadapi": {
// support
// target: "https://myriad-support.xinongtech.com/",
// test
// target: "https://myriad-test.xinongtech.com/",
target: "https://myriadweb-test.chainmind.xyz",
changeOrigin: true,
},
},
},
};