-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.umirc.js
85 lines (78 loc) · 2.13 KB
/
.umirc.js
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
import { readdirSync } from 'fs';
import chalk from 'chalk';
import { join } from 'path';
const { REACT_APP_ENV } = process.env;
const isSite = REACT_APP_ENV !== 'dev';
const headPkgList = [];
// utils must build before core
// runtime must build before renderer-react
const pkgList = readdirSync(join(__dirname, 'packages')).filter(
(pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg),
);
const alias = pkgList.reduce((pre, pkg) => {
pre[`@wetrial/${pkg}`] = join(__dirname, 'packages', pkg, 'src');
return {
...pre,
};
}, {});
console.log(`🌼 alias list \n${chalk.blue(Object.keys(alias).join('\n'))}`);
const tailPkgList = pkgList
// .map((path) => [join('packages', path, 'src'), join('packages', path, 'docs')])
.map((path) => [join('packages', path, 'src')])
.reduce((acc, val) => acc.concat(val), []);
// const isProduction = process.env.NODE_ENV === 'production';
export default {
title: 'Wetrial',
mode: 'site',
hash: true,
// history: 'hash',
base: '/wetrials',
publicPath: '/wetrials/',
exportStatic: {}, // 将所有路由输出为 HTML 目录结构,以免刷新页面时 404
// ssr: {},
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
extraBabelPlugins: [
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
],
],
alias: {
// 增加其他不是index导出的模块alias
'@wetrial/component/es': join(__dirname, 'packages', 'component/src'),
...alias,
},
resolve: { includes: [...tailPkgList, 'docs'] },
locales: [['zh-CN', '中文']],
navs: [
null,
{
title: 'GitHub',
path: 'https://github.com/wetrial/wetrials',
},
],
// analytics: isProduction
// ? {
// ga: 'UA-173569162-1',
// }
// : false,
hash: true,
dynamicImport: {},
metas: [
{
name: 'keywords',
content: 'wetrial,components',
},
{
name: 'description',
content: '🍙 这里放置了 Wetrials 系列组件',
},
],
styles: [
`${isSite ? 'https://wetrial.github.io' : 'http://localhost:10000'}/wetrials/global.css`,
],
};