首页 > 解决方案 > 已发布库中的 TS 文件通常是库打包不良的标志

问题描述

我正在尝试在 Ionic 4 中进行单元测试,因此我们制作了 mobilecore 库并放入 node_modules 并从那里我们使用组件、服务和装饰器(所有文件都是 ts 格式,它们不是 tsc 编译的)。

我创建了一个空白项目,并在主页中调用 @PageTrack 装饰器来跟踪 firebase 中的页面,我已将其包含在 tsconfig.spec.json 和 tsconfig.app.json 中,但仍然出现错误:

./node_modules/mobile-core/src/app/decorators/page-track.decorator.ts 中的错误模块构建失败(来自 ./node_modules/@ngtools/webpack/src/index.js):错误:D:\Testing TypeScript 编译中缺少 \testingdemo\node_modules\mobile-core\src\app\decorators\page-track.decorator.ts。请通过 'files' 或 'include' 属性确保它在您的 tsconfig 中。丢失的文件似乎是第三方库的一部分。已发布库中的 TS 文件通常是库打包不良的标志。请在库存储库中打开一个问题以提醒其作者并要求他们使用 AngularCompilerPlugin.getCompiledFile 中的 Angular 包格式打包库 (D:\Testing\testingdemo\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:869: 23) 在 plugin.done.then (D:

有人可以建议我哪里错了或者如何在使用时排除这个装饰器npm run test

标签: angulartypescriptionic-frameworkjasmine

解决方案


推荐阅读