medium-editor.directive.ts is missing from the TypeScript compilation

306 views Asked by At

Not able to use angular-medium-editor library in Angular 5

Packages installed:

"angular-medium-editor": "^4.0.0-alpha",
"angular/core": "^5.2.0",
"typescript": "~2.5.3"

During ng serve command I get the following error:

ERROR in ./node_modules/angular-medium-editor/medium-editor.directive.ts
Module build failed: Error: /Users/K2A/GIT/traveldiary/webapp/node_modules/angular-medium-editor/medium-editor.directive.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format 
at AngularCompilerPlugin.getCompiledFile (/webapp/node_modules//src/angular_compiler_plugin.js:656:23)
at plugin.done.then (/node_modules//src/loader.js:467:39)
at 
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./src/app/pages/pages.module.ts 18:32-88
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

How to fix this issue and use the library?

1

There are 1 answers

0
Daniel On

The error message

The error message oocurs because the library includes TypeScript files. The Angular Package Format requires a properly packaged library to not include any TypeScript files to prevent issues with different versions of TypeScript at compilation time.

The actual problem

If you check out the GitHub site of angular-medium-editor you'll see it is an AngularJS plugin which won't work for any version of Angular.

It seems someone has made an Angular port of it (angular2-medium-editor), see GitHub.