-
Notifications
You must be signed in to change notification settings - Fork 2
/
.umirc.ts
90 lines (85 loc) · 2.34 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
import path, { resolve } from 'path'
import { defineConfig } from 'umi'
import OfflinePlugin from 'offline-plugin'
import WebpackPwaManifest from 'webpack-pwa-manifest'
import AntDesignThemePlugin from 'antd-theme-webpack-plugin'
import theme from './src/themes'
export default defineConfig({
antd: {},
cssnano: {},
theme: theme,
base: '/testool/',
favicon: 'favicon.ico',
publicPath: '/testool/',
dva: { immer: true, hmr: true },
alias: { R: resolve(__dirname, './') },
links: [ { rel: 'manifest', href: 'manifest.json' } ],
dynamicImport: { loading: '@/components/Loader/index' },
locale: { baseNavigator: false, default: 'en-US', antd: true },
lessLoader: {
javascriptEnabled: true
},
extraBabelPlugins: [
[
'import',
{
libraryName: 'lodash',
libraryDirectory: '',
camel2DashComponentName: false
}
]
],
chainWebpack (memo) {
memo.resolve.alias.set(
'moment$',
path.resolve(__dirname, 'node_modules/moment/moment.js')
)
memo.plugin('antd-theme').use(AntDesignThemePlugin, [ webpack_plugin_antd_theme ])
memo.plugin('offline-plugin').use(OfflinePlugin, [ webpack_plugin_offline ])
memo.plugin('webpack-pwa-manifest').use(WebpackPwaManifest, [ webpack_plugin_pwa ])
}
})
const webpack_plugin_offline: any = {
safeToUseOptionalCaches: true,
ServiceWorker: { events: true },
AppCache: { events: true }
}
const webpack_plugin_pwa: any = {
name: 'Testool',
short_name: 'Testool',
fingerprints: false,
description: 'A artifact for the test/interview/exam.',
background_color: '#ffffff',
theme_color: '#f44336',
crossorigin: 'use-credentials',
icons: [
{
src: path.resolve(__dirname, 'public/logo.png'),
sizes: [ 96, 128, 192, 256, 384, 512 ]
},
{
src: path.resolve(__dirname, 'public/logo_white.png'),
size: '512x512'
}
]
}
const webpack_plugin_antd_theme: any = {
antDir: path.join(__dirname, './node_modules/antd'),
stylesDir: path.join(__dirname, './src/themes'),
varFile: path.join(__dirname, './src/themes/skins/default.less'),
mainLessFile: path.join(__dirname, './src/global.less'),
themeVariables: [
'@text-color',
'@disabled-color',
'@item-hover-bg',
'@component-background',
'@background-color-light',
'@background-color-base',
'@text-color-secondary',
'@body-background',
'@border-color-base',
'@border-color-split'
],
lessUrl: 'less.min.js',
publicPath: '/testool'
}