@umijs/plugins 4.0.0-rc.16 → 4.0.0-rc.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/antd.js CHANGED
@@ -62,14 +62,14 @@ exports.default = (api) => {
62
62
  // antd import
63
63
  memo.alias.antd = pkgPath;
64
64
  // moment > dayjs
65
- if (memo.antd.dayjs) {
65
+ if (antd.dayjs) {
66
66
  memo.alias.moment = (0, path_1.dirname)(require.resolve('dayjs/package.json'));
67
67
  }
68
68
  // dark mode & compact mode
69
- if (memo.antd.dark || memo.antd.compact) {
69
+ if (antd.dark || antd.compact) {
70
70
  const { getThemeVariables } = require('antd/dist/theme');
71
71
  memo.theme = {
72
- ...getThemeVariables(memo.antd),
72
+ ...getThemeVariables(antd),
73
73
  ...memo.theme,
74
74
  };
75
75
  }
package/dist/layout.js CHANGED
@@ -22,12 +22,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  const allIcons = __importStar(require("@ant-design/icons"));
30
- const assert_1 = __importDefault(require("assert"));
31
27
  const path_1 = require("path");
32
28
  const plugin_utils_1 = require("umi/plugin-utils");
33
29
  const resolveProjectDep_1 = require("./utils/resolveProjectDep");
@@ -191,9 +187,6 @@ const { formatMessage } = useIntl();
191
187
  const { icon } = api.appData.routes[id];
192
188
  if (icon) {
193
189
  const upperIcon = plugin_utils_1.lodash.upperFirst(plugin_utils_1.lodash.camelCase(icon));
194
- (0, assert_1.default)(
195
- // @ts-ignore
196
- allIcons[upperIcon] || allIcons[`${upperIcon}Outlined`], `Icon ${upperIcon} is not found`);
197
190
  // @ts-ignore
198
191
  if (allIcons[upperIcon]) {
199
192
  memo[upperIcon] = true;
@@ -238,7 +231,9 @@ export function patchRoutes({ routes }) {
238
231
  const { icon } = routes[key];
239
232
  if (icon && typeof icon === 'string') {
240
233
  const upperIcon = formatIcon(icon);
241
- routes[key].icon = React.createElement(icons[upperIcon] || icons[upperIcon + 'Outlined']);
234
+ if (icons[upperIcon] || icons[upperIcon + 'Outlined']) {
235
+ routes[key].icon = React.createElement(icons[upperIcon] || icons[upperIcon + 'Outlined']);
236
+ }
242
237
  }
243
238
  });
244
239
  }
@@ -122,8 +122,10 @@ export function genMount(mountElementId: string) {
122
122
  // 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
123
123
  // 考虑到 react 18 之后 callback 不再准
124
124
  // 所以在这里直接返回,而不使用 ReactDOM.render 的第三个参数
125
- if (props.autoSetLoading && typeof props.setLoading === 'function') {
126
- props.setLoading(false);
125
+ if (typeof props !== 'undefined') {
126
+ if (props.autoSetLoading && typeof props.setLoading === 'function') {
127
+ props.setLoading(false);
128
+ }
127
129
  }
128
130
  hasMountedAtLeastOnce = true;
129
131
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.0-rc.16",
3
+ "version": "4.0.0-rc.19",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -25,7 +25,7 @@
25
25
  "@ahooksjs/use-request": "^2.0.0",
26
26
  "@ant-design/icons": "^4.7.0",
27
27
  "@ant-design/pro-layout": "^6.38.0",
28
- "@umijs/bundler-utils": "4.0.0-rc.16",
28
+ "@umijs/bundler-utils": "4.0.0-rc.19",
29
29
  "antd-dayjs-webpack-plugin": "^1.0.6",
30
30
  "axios": "^0.27.2",
31
31
  "babel-plugin-import": "^1.13.3",
@@ -44,7 +44,7 @@
44
44
  "warning": "^4.0.3"
45
45
  },
46
46
  "devDependencies": {
47
- "umi": "4.0.0-rc.16"
47
+ "umi": "4.0.0-rc.19"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"