我已经通过使用create-react-app cli创建了一个react应用。该应用程序运行良好。我必须使用wordpress 5中的guttenberg编辑器。
https://github.com/front/gutenberg-js中有一个纯JavaScript版本。 问题是当我尝试domReady时,请使用以下import语句
import { domReady, editPost } from '@frontkom/gutenberg-js';
我的react应用程序无法正常工作
以下是例外
gutenberg-js.js:104 Uncaught TypeError: Cannot read property 'createContext' of undefined
at Module.push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:104)
at n (gutenberg-js.js:17)
at Module.push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:45274)
at n (gutenberg-js.js:17)
at push../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:51)
at Object../node_modules/@frontkom/gutenberg-js/build/js/gutenberg-js.js (gutenberg-js.js:52)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/components/PageEditor.js (HomeComponent.js:13)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Module../src/index.js (index.css?f3f6:45)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.0 (store.js:12)
at __webpack_require__ (bootstrap:781)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
期望导入应该起作用。