-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.umirc.ts
65 lines (64 loc) · 2.22 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
import { defineConfig } from 'umi';
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
import CONFIG from './config';
export default defineConfig({
dynamicImport: {
loading: '@/components/Loading/GlobalLoading',
},
chunks: ['basic', 'vendors.umi', 'umi'],
chainWebpack: (config, { webpack }) => {
config.merge({
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000,
maxSize: 0,
name: true,
minChunks: 1,
maxAsyncRequests: 10,
maxInitialRequests: 5,
automaticNameDelimiter: '.',
cacheGroups: {
basic: {
name: 'basic',
test({ resource }) {
return /(@antd|antd|@ant-design|react)/.test(
resource,
);
},
priority: 100,
},
monacoEditor: {
name: true,
test({ resource }) {
return /monaco/.test(resource);
},
priority: 99,
},
},
},
},
});
//更多配置 https://github.com/Microsoft/monaco-editor-webpack-plugin#options
config.plugin('monaco-editor-webpack-plugin').use(MonacoWebpackPlugin, [
// 按需配置
{
languages: CONFIG.monacoEditorSupportedLanguages,
publicPath: CONFIG.publicPath,
},
]);
return config;
},
title: CONFIG.title,
nodeModulesTransform: {
type: 'none',
},
analytics: CONFIG.analytics,
hash: true,
routes: [
{ path: '/', component: '@/pages/index', exact: true },
{ path: '/code', component: '@/pages/code', exact: true },
{ path: '/diff', component: '@/pages/diff', exact: true },
],
publicPath: CONFIG.publicPath,
});