TypeScript编译中缺少medium-editor.directive.ts

时间:2018-04-15 07:08:19

标签: typescript angular5 medium-editor

无法在Angular 5中使用角度介质编辑器库

已安装的软件包:

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

ng serve命令期间,我收到以下错误:

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

如何解决此问题并使用该库?

1 个答案:

答案 0 :(得分:0)

错误消息

错误消息oocurs,因为该库包含TypeScript文件。 Angular Package Format要求正确打包的库不包含任何TypeScript文件,以防止在编译时出现不同版本的TypeScript问题。

实际问题

如果你查看angular-medium-editor的{​​{3}},你会发现它是一个AngularJS插件,不适用于任何版本的Angular。

似乎有人制作了Angular端口(angular2-medium-editor),请参阅the GitHub site