首页 > 解决方案 > import mobx-state-tree throws 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

标签: javascriptnode.jsmobx

解决方案


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


推荐阅读