-
Notifications
You must be signed in to change notification settings - Fork 0
/
.umirc.ts
61 lines (58 loc) · 1.68 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
import { join } from 'path';
import { defineConfig, IConfig } from 'umi';
const isProd = process.env.NODE_ENV === 'production';
const flatDep = ['react-native-gesture-handler',]
export default defineConfig({
history: { type: 'hash' },
nodeModulesTransform: {
type: 'all',
},
locale: {
default: 'zh'
},
alias: {
...flatDep.reduce((acc, dep) => ({ ...acc, [dep]: join(__dirname, `node_modules`, dep) }), {}),
"@modules": join(__dirname, "./src/modules"),
"@components": join(__dirname, "./src/components"),
"@hooks": join(__dirname, "./src/hooks"),
"@i18n": join(__dirname, "./src/i18n")
},
fastRefresh: {},
// code split
ignoreMomentLocale: true,
chainWebpack(config) {
config.optimization.splitChunks({
chunks: 'all',
automaticNameDelimiter: '~',
name: true,
minSize: 30000,
minChunks: 1,
cacheGroups: {
'tuya-panel-kit': {
name: 'tuya-panel-kit',
test: /[\\/]node_modules[\\/](tuya-panel-kit)[\\/]/,
priority: -9,
enforce: true,
},
'umi-plugin-react-native': {
name: 'umi-plugin-react-native',
test: /[\\/]node_modules[\\/](umi-plugin-react-native)[\\/]/,
priority: -10,
enforce: true,
},
vendors: {
name: 'vendors',
test: /[\\/]node_modules[\\/]/,
priority: -11,
enforce: true,
},
},
});
},
// https://umijs.org/zh-CN/config#chunks
chunks: ['vendors', 'umi-plugin-react-native', 'tuya-panel-kit', 'umi'],
hash: isProd,
publicPath: isProd
? '//cdn.jsdelivr.net/gh/TuyaInc/tuya-panel-kit-example@gh-pages/'
: '/',
} as IConfig);