forked from ayanamy/larp-front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.umirc.ts
101 lines (100 loc) · 2.79 KB
/
.umirc.ts
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
97
98
99
100
101
import { defineConfig } from 'umi';
export default defineConfig({
nodeModulesTransform: {
type: 'none',
},
routes: [
{ path: '/login', component: '@/pages/Login' },
{ path: '/', component: '@/pages/index', redirect: '/login' },
{
path: '/',
component: '@/layouts',
routes: [
{ path: '/gamer', component: '@/pages/Gamer' },
{ path: '/admin', component: '@/pages/Admin' },
{ path: '/dm', component: '@/pages/DM' },
],
},
],
mfsu: {},
dva: {
immer: true,
lazyLoad: true,
},
fastRefresh: {},
chunks:
process.env.NODE_ENV === 'production'
? ['reactVendor', 'antd', 'umiVendor', 'vendors', 'default', 'umi']
: ['umi'],
// dynamicImport: {},
devtool:
process.env.NODE_ENV === 'production'
? 'source-map'
: 'cheap-module-source-map',
chainWebpack(config, { env, webpack, createCSSRule }) {
config.output.set(
'path',
'/home/culler/code/workspace/game/src/main/resources/templates/dist',
);
if (process.env.NODE_ENV === 'production') {
config.merge({
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 3,
automaticNameDelimiter: '.',
cacheGroups: {
// vendor: {
// name: 'vendors',
// test({ resource }: { resource: string }) {
// return /[\\/]node_modules[\\/]/.test(resource);
// },
// priority: 10,
// },
reactVendor: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: 'reactVendor',
enforce: true,
priority: 5,
},
antd: {
test: /[\\/]node_modules[\\/](antd)[\\/]/,
name: 'antd',
enforce: true,
priority: 4,
},
umiVendor: {
test: /[\\/]node_modules[\\/](umi).*[\\/]/,
name: 'umiVendor',
enforce: true,
priority: 3,
},
vendors: {
name: 'vendors',
enforce: true,
priority: 1,
test: /[\\/]node_modules[\\/]((?!(@dzg|antd|react|react-dom|umi)).*)[\\/]/,
},
default: {
test: /[\\/]src[\\/]((?!(pages)).*)[\\/]/,
name: 'default',
enforce: true,
},
},
},
},
});
}
},
publicPath: '/larp/',
hash: true,
history: { type: 'hash' },
proxy: {
'/api': {
target: `http://localhost:8011`, // 测试环境
changeOrigin: true,
pathRewrite: { '^/api': '/larp' },
},
},
});