antd-mobile,使用babel-plugin-import,未捕获错误:元素类型无效

时间:2018-09-07 01:46:57

标签: javascript webpack antd-mobile

“ redux”:“ ^ 4.0.0”, 节点:v10.2.1

.babelrc

{
    "presets": ["env", "react"],
    "plugins": [
        "babel-plugin-transform-runtime",
        "transform-object-rest-spread",
        ["import", { "libraryName": "antd-mobile",  "style": "css"}] 
    ]
}

脚本:

import { Button } from "antd-mobile";
...
<Button type="primary">primary</Button>
...

然后它来了:

invariant.js:42 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Check the render method of `Button`.

我该如何解决?

0 个答案:

没有答案