新的 prosemirror.model lib (1.18.1) 在控制台中导致错误:架构不是构造函数

问题描述 投票:0回答:1

我对 React 相当陌生,现在尝试修复由于我们的工件中的 prosemirror.model 新版本而在运行时发生的错误。新版本是1.18.1,旧版本是1.16.1。

加载页面在控制台中出现以下错误:

Uncaught TypeError: prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Schema is not a constructor
    at Module.../../components/src/20-molecules/rte/config/schema.js (schema.js:122:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module.../../components/src/20-molecules/rte/index.js (editor.css?e9c4:45:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module.../../components/src/index.js (index.js:1:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module../src/containers/edit/edit.js (index.scss?46f0:45:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module../src/containers/edit/index.js (edit.js:600:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module../src/App.js (types.js:3:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Module../src/index.js (i18n.js:74:1)
    at __webpack_require__ (bootstrap:781:1)
    at fn (bootstrap:149:1)
    at Object.0 (url.js:251:1)
    at __webpack_require__ (bootstrap:781:1)
    at checkDeferredModules (bootstrap:45:1)
    at Array.webpackJsonpCallback [as push] (bootstrap:32:1)
    at main.chunk.js:1:57

中断的代码行:

export const schema = new Schema({ nodes, marks });

我试图找到在没有构造函数的情况下创建 Schema 实例的代码,但无法识别它。甚至 prosemirror 指南和代码本身也使用构造函数来创建 Schema 对象,所以我对此感到非常困惑。 有人知道如何解决这个问题吗?

javascript reactjs prose-mirror ordered-map
1个回答
0
投票

我将依赖项中的行修改为“prosemirror-model”:“1.21.0”,然后运行 npm i

为我工作

© www.soinside.com 2019 - 2024. All rights reserved.