Javascript CKEditor5设置';无法读取属性';创建';未定义的';
我正在尝试使用Javascript CKEditor5设置';无法读取属性';创建';未定义的';,javascript,typescript,webpack,ecmascript-6,ckeditor,Javascript,Typescript,Webpack,Ecmascript 6,Ckeditor,我正在尝试使用@ckeditor/CKEditor5 build classicnpm包在我的站点上设置CKEditor5。我已经安装了12.0.0版,这是今天最新的版本 我使用下面的设置方法-看起来应该很简单 我使用的是TypeScript,模块中包含以下代码: import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; ClassicEditor .create(document.querySelector('.ht
@ckeditor/CKEditor5 build classic
npm包在我的站点上设置CKEditor5。我已经安装了12.0.0版,这是今天最新的版本
我使用下面的设置方法-看起来应该很简单
我使用的是TypeScript,模块中包含以下代码:
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
ClassicEditor
.create(document.querySelector('.html-editor'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});
…将传输到以下JavaScript中:
var ckeditor5_build_classic_1 = require("@ckeditor/ckeditor5-build-classic");
ckeditor5_build_classic_1["default"]
.create(document.querySelector('.html-editor'))
.then(function (editor) {
console.log(editor);
})["catch"](function (error) {
console.error(error);
});
不幸的是,我在加载页面时遇到以下错误:
addadventure.ts:11 Uncaught TypeError: Cannot read property 'create' of undefined
at Object.<anonymous> (addadventure.ts:11)
at Object../wwwroot/js/pages/adventures/addadventure.ts (addadventure.ts:266)
at __webpack_require__ (bootstrap:781)
at fn (bootstrap:149)
at Object.1 (addadventure.ts:266)
at __webpack_require__ (bootstrap:781)
at checkDeferredModules (bootstrap:45)
at bootstrap:857
at bootstrap:857
那么问题出在传输上了吗?您是否尝试过设置/取消设置
esModuleInterop
和allowSyntheticDefaultImports
编译器选项?您尝试过使用此import
吗
import * as InlineEditor from '@ckeditor/ckeditor5-build-inline';
import * as InlineEditor from '@ckeditor/ckeditor5-build-inline';