语义ui react __webpack_require __。i(...)不是一个函数

时间:2019-05-19 10:51:07

标签: reactjs webpack semantic-ui

我正在使用3.4.0版的React Boilerplate,当从语义UI反应导入组件时,出现以下错误:

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: {…}, …}

我正在使用Webpack 2.6.1

1 个答案:

答案 0 :(得分:0)

好的,问题解决了(在StackOverflow上发布一晚零十分钟后,我找到了解决方法:p)

我正在使用语义ui react,其版本兼容我正在使用的react 16而不是react 15。

然后我使用以下命令将语义UI反应降级为0.81.3版本

          MarkerOptions().position(paris).title("Marker in Ocean"));
          try {
              String sql = "SELECT 
                     marker.markerLat,marker.markerLon,marker.markerDate 
                    FROM marker LEFT JOIN tripMarker ON" +
                     " marker.markerID = tripMarker.markerID LEFT 
                     JOIN userTrip ON userTrip.tripID = 
                     tripMarker.tripID " +
                   "WHERE userTrip.userID = '" + User.UserLoggedOn 
                     + "';";
              Cursor cursor = db.rawQuery(sql, null);
              while (cursor.moveToNext()) {
                      double lat = 
                  cursor.getDouble(cursor.getColumnIndex("markerLat"));
                  System.out.println(lat);
                  double lon = 
                  cursor.getDouble(cursor.getColumnIndex("markerLon"));
                  System.out.println(lon);
                  LatLng latLng = new LatLng(lat, lon);
                  MarkerOptions markerOptions = new 
                      MarkerOptions();
                  markerOptions.position(latLng);                        
                  map.addMarker(markerOptions.title(cursor.getString(
                      cursor.getColumnIndex("markerDate"))));
              }
          }catch (Exception e){
              e.printStackTrace();
          }