``ng build''跳过/不发布Angular 6库.d.ts文件的组件(某些组件未生成类型定义)

时间:2019-03-18 17:48:23

标签: angular typescript angular-cli angular-components angular-library

我正在尝试为一个工作项目发布Angular 6+组件库,并且遇到了一个可疑问题,看起来像是编译器错误。

这是源代码存储库,但是我在下面也包含了演示问题的代码。

https://github.com/bradkovach/porcelain/tree/master/projects/porcelain/src

该项目是使用ng generate library生成的,理论上现在可以推送到npm了。每当我运行ng build porcelain时,项目都不会生成错误,但是编译后的结果缺少两个组件SimpleRefinerComponentDateRefinerComponent的类型定义。我发现以下StackOverflow article似乎也遇到了同样的问题,但上述解决方案对我不起作用。

我已使用这些命令在单独的计算机上构建了项目...

git clone git@github.com:bradkovach/porcelain.git
npm install
ng build porcelain

这是public_api.ts上的projects/porcelain/src/public_api.ts文件的样子……

/**
 * Porcelain exposed components.
 */

export { PorcelainModule } from './lib/porcelain.module';
export { PorcelainComponent } from './lib/porcelain.component';

export { SimpleRefinerModule } from './lib/simple-refiner/simple-refiner.module';
export { SimpleRefinerComponent } from './lib/simple-refiner/simple-refiner.component';

export { DateRefinerModule } from './lib/date-refiner/date-refiner.module';
export { DateRefinerComponent } from './lib/date-refiner/date-refiner.component';

export { RefinersModule } from './lib/refiners/refiners.module';
export { RefinersComponent } from './lib/refiners/refiners.component';

export * from './lib/refiners/IOption';
export * from './lib/refiners/IOptions';
export * from './lib/refiners/IRefiner';
export * from './lib/refiners/IRefinerValue'

当我运行ng build时,它将构建以下public_api.d.ts文件...

/**
 * Porcelain exposed components.
 */
export { PorcelainModule } from './lib/porcelain.module';
export { PorcelainComponent } from './lib/porcelain.component';
export { SimpleRefinerModule } from './lib/simple-refiner/simple-refiner.module';
export { SimpleRefinerComponent } from './lib/simple-refiner/simple-refiner.component';
export { DateRefinerModule } from './lib/date-refiner/date-refiner.module';
export { DateRefinerComponent } from './lib/date-refiner/date-refiner.component';
export { RefinersModule } from './lib/refiners/refiners.module';
export { RefinersComponent } from './lib/refiners/refiners.component';
export * from './lib/refiners/IOption';
export * from './lib/refiners/IOptions';
export * from './lib/refiners/IRefiner';
export * from './lib/refiners/IRefinerValue';

SimpleRefinerComponentDateRefinerComponent导出分别报告以下错误

  • Cannot find module './lib/simple-refiner/simple-refiner.component'.ts(2307)
  • Cannot find module './lib/date-refiner/date-refiner.component'.ts(2307)

我尝试过

0 个答案:

没有答案