0

无法在 Angular 5 中使用 angular-medium-editor 库

安装的软件包:

"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

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

4

1 回答 1

0

错误信息

出现错误消息是因为库包含 TypeScript 文件。Angular 包格式需要一个正确打包的库,不包含任何 TypeScript 文件,以防止在编译时出现不同版本的 TypeScript 问题。

实际问题

如果您查看GitHub 站点angular-medium-editor您会发现它是一个 AngularJS 插件,它不适用于任何版本的 Angular。

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

于 2018-04-15T08:15:47.993 回答