微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

导入 mobx-state-tree 抛出 Uncaught TypeError: Object(...) is not a function

如何解决导入 mobx-state-tree 抛出 Uncaught TypeError: Object(...) is not a function

import { types } from "mobx-state-tree";

抛出错误

mobx-state-tree.module.js:2354 Uncaught TypeError: Object(...) is not a function
    at CoreType.BaseType (mobx-state-tree.module.js:2354)
    at CoreType.SimpleType [as constructor] (mobx-state-tree.module.js:2554)
    at new CoreType (mobx-state-tree.module.js:6418)
    at Module.<anonymous> (mobx-state-tree.module.js:6491)
    at Module../node_modules/mobx-state-tree/dist/mobx-state-tree.module.js (mobx-state-tree.module.js:8319)
    at __webpack_require__ (bootstrap:19)
    at Module../js/app.js (app.js:1)
    at __webpack_require__ (bootstrap:19)
    at Object.0 (global.js:20)
    at __webpack_require__ (bootstrap:19)

这是为什么?我所做的只是导入。

版本是5.0.0

解决方法

我不得不将 mobx 从版本 5 更新到版本 6

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。