Uncaught TypeError: Object(…) is not a function when importing @material-ui/pickers

三世轮回 提交于 2019-12-10 17:28:44

问题


I am using "@material-ui/core": "^3.9.3" with "@material-ui/pickers": "^3.0.0-beta.1"

When I import anything from @material-ui/pickers I get:

Uncaught TypeError: Object(...) is not a function
at Module../node_modules/@material-ui/pickers/dist/material-ui-pickers.esm.js (material-ui-pickers.esm.js:25)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/views/Event/Create.js (User.js:18)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/Routes.js (Routes.js:1)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/layouts/Admin.jsx (index.js:73)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/index.js (index.css?02e3:45)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.0 (Notifications.jsx:300)
at __webpack_require__ (bootstrap:781)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1

回答1:


Make sure that @material-ui/pickers is the new npm package, that serving next version. And it's required @material-ui/core at least v4.0.0-beta.0

For the old v3 version of material-ui, use material-ui-pickers package and version v2.2.4



来源:https://stackoverflow.com/questions/56010268/uncaught-typeerror-object-is-not-a-function-when-importing-material-ui-pi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!