【问题标题】:medium-editor.directive.ts is missing from the TypeScript compilationTypeScript 编译中缺少 medium-editor.directive.ts
【发布时间】:2018-04-15 07:08:18
【问题描述】:

无法在 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

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

【问题讨论】:

    标签: typescript angular5 medium-editor


    【解决方案1】:

    错误信息

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

    实际问题

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

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

    【讨论】:

      猜你喜欢
      • 2019-01-05
      • 2018-10-01
      • 2020-11-26
      • 2018-08-12
      • 1970-01-01
      • 1970-01-01
      • 2021-02-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多