-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.ts
38 lines (33 loc) · 894 Bytes
/
plugin.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
// 建议放置项目级插件
import type { IApi } from 'umi';
export default (api: IApi) => {
// 测试
api.onDevCompileDone((opts) => {
console.log('> onDevCompileDone', opts.isFirstCompile);
});
api.onBuildComplete((opts) => {
console.log('> onBuildComplete', opts.isFirstCompile);
});
api.onStart(() => {
console.log('> onStart');
});
// 设置 layout 组件
// api.addLayouts(() => {
// return { id: 'default', file: '@/layouts/default/index' };
// });
// 修改 HTML
api.modifyHTML(($) => {
$('head').append([
`<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js'></script>`,
`<script src=''></script>`,
]);
return $;
});
// // 通过插件设置环境变量
// process.env.COMPRESS = "none";
// // 通过插件修改配置
// api.modifyConfig((memo: any) => {
// memo.title = "Hello Umi";
// return memo;
// });
};