Encountering some difficulties while utilizing @types/ckeditor from the provided source.
https://www.npmjs.com/package/@types/ckeditor
The installation of the package was successful, and after importing the type into the necessary file, everything appears correct in VS code.
import "CKEDITOR";
import { Injectable } from '@angular/core';
export interface IEditor {
editor: CKEDITOR.editor
addEventHandler(eventName: string, onEvent: Function): void;
addContextMenuItem(menulabel: string, onEvent: Function): void;
getTrackingPlugin(): any;
}
@Injectable({
providedIn: 'root'
})
export class Editor implements IEditor {
public editor: CKEDITOR.editor
constructor(rootElement: HTMLElement, config: CKEDITOR.config) {
this.editor = CKEDITOR.inline(rootElement, config);
}
}
Although everything seems fine, upon building, the following error is displayed.
ERROR in ./src/app/modules/single-editor/services/editor.service.ts
Module not found: Error: Can't resolve 'CKEDITOR' in 'C:\Code\***\src\web\src\app\modules\single-editor\services'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="295e4c4b691907190719">[email protected]</a> build: `ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5126343311617f617f61">[email protected]</a> build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\***\AppData\Roaming\npm-cache\_logs\2019-05-07T10_31_08_926Z-debug.log
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
The above code is contained within its own module, the Angular version being used is up-to-date, and ckeditor 4 is in use.