config.ts
2.14 KB
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
import { defineConfig } from "umi";
import routers from "./routers";
import proxy from "./proxy";
import webpackPlugin from "./plugin.config";
const { REACT_APP_ENV } = process.env;
export default defineConfig({
dva: {
hmr: true,
},
fastRefresh: {},
devtool: false,
// umi routes: https://umijs.org/zh/guide/router.html
routes: routers,
define: {
PROD_APP_ENV: (REACT_APP_ENV || "dev") === "prod",
},
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
"primary-color": (REACT_APP_ENV || "dev") === "prod" ? "#1890FF" : "#FAAD14",
},
// layout: defaultSettings,
locale: {
// default zh-CN
default: "zh-CN",
// default true, when it is true, will use `navigator.language` overwrite default
antd: true,
baseNavigator: true,
},
ignoreMomentLocale: true,
dynamicImport: {
loading: "@/components/PageLoading/index",
},
manifest: {
basePath: "/",
},
base: "/",
hash: true,
history: {
type: "hash",
},
proxy: proxy[REACT_APP_ENV || "dev"],
nodeModulesTransform: {
type: process.env.NODE_ENV == "development" ? "none" : "all",
exclude: [],
},
externals: {
"@antv/g2": "G2",
"@antv/data-set": "DataSet",
bizcharts: "BizCharts",
lodash: "window._",
react: "window.React",
"react-dom": "window.ReactDOM",
"@ant-design/icons": "icons",
},
scripts:
process.env.NODE_ENV === "development"
? [
"https://gw.alipayobjects.com/os/lib/react/16.13.1/umd/react.development.js",
"https://gw.alipayobjects.com/os/lib/react-dom/16.13.1/umd/react-dom.development.js",
"https://cdn.staticfile.org/lodash.js/4.17.15/lodash.min.js",
"https://cdn.staticfile.org/ant-design-icons/4.1.0/index.umd.js",
]
: [
"https://gw.alipayobjects.com/os/lib/react/16.13.1/umd/react.production.min.js",
"https://gw.alipayobjects.com/os/lib/react-dom/16.13.1/umd/react-dom.production.min.js",
"https://cdn.staticfile.org/lodash.js/4.17.15/lodash.min.js",
"https://cdn.staticfile.org/ant-design-icons/4.1.0/index.umd.min.js",
],
chainWebpack: webpackPlugin,
});