我使用的是React Boilerplate 3.4.0版,从语义UI-react导入组件时出现以下错误:
Dynamic page loading failed TypeError: __webpack_require__.i(...) is not a function
at new Button (Button.js:83)
at eval (ReactCompositeComponent.js:295)
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:294)
at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:280)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:188)
at Object.mountComponent (ReactReconciler.js:46)
at ReactDOMComponent.mountChildren (ReactMultiChild.js:238)
at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:691)
at ReactDOMComponent.mountComponent (ReactDOMComponent.js:516)
我正在使用导入按钮组件
import { Button } from 'semantic-ui-react'
但最让我惊讶的是,对于某些组件,导入有效:
import { Grid } from 'semantic-ui-react'
作品。
另外,当我将组件记录在render函数之外时:
console.log(<Button></Button>)
我得到相关的日志:
{$$typeof: Symbol(react.element), type: ƒ, key: null, ref: null,
props: {…}, …}
好的,问题解决了(在StackOverflow上发布后搜索了一晚零十分钟,我找到了解决方法:p)
我正在使用语义ui react和一个兼容版本16,而不是我正在使用的react 15。
然后,我使用以下命令将语义UI反应降级为0.81.3版本
yarn add [email protected]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句