ant

BasicLayout

  • react-document-title:Declarative, nested, stateful, isomorphic document.title for React

  • memoize-one:A memoization library which only remembers the latest invocation

  • react-container-query:True modularity in styling responsive component.

  • classnames:A simple javascript utility for conditionally joining classNames together

  • enquire-js:避免服务端渲染报错

  • path-to-regexp:Turn a path string such as /user/:name into a regular expression

  • moment:Parse, validate, manipulate, and display dates in javascript.

umi 配置文件里的 ./ 相对于 /src/pages 目录

组件路径中的 @ 相当于 /src


国际化还没处理

umi报错

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
 npm start

> [email protected] start /Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin
> cross-env APP_TYPE=site umi dev

{ Error: Cannot find module './lib/compressor'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Module.require (internal/modules/cjs/loader.js:643:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/antd-theme-generator/node_modules/less-)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Module._compile (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Object.newLoader [as .js] (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/pirates/lib/index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:605:32) code: 'MODULE_NOT_FOUND' }
/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/UserConfig.js:188
throw new Error(msg);
^

Error: 配置文件 "config/config.js" 解析出错,请检查语法。

Error: Cannot find module './lib/compressor'
at onError (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/UserConfig.js:188:13)
at requireFile (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/UserConfig.js:99:12)
at UserConfig.getConfig (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/UserConfig.js:191:7)
at Service.init (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/Service.js:287:31)
at Service.run (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi-build-dev/lib/Service.js:320:10)
at Object.<anonymous> (/Users/wangfukang/Desktop/project/frontend-proj/qinhetea-admin/node_modules/umi/lib/scripts/realDev.js:28:47)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `cross-env APP_TYPE=site umi dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wangfukang/.npm/_logs/2018-11-09T03_44_21_728Z-debug.log

常见错误

Table 中数据的 key 未指定

key 引起的警告

FormItem 中出现多个 getFieldDecorator

Form 自定义 validator 校验时,callback 必须被调用