将我的项目更新到最新版本的 Angular (6.0.4) 后,我想最终将我的代码分离到不同的库中。
设置如下:
- CMS - 应用程序
- 客户端 - 应用程序
- 核心 - 两个应用程序共享成员的库
我创建了 3 个空项目并开始将所有组件和服务移动到正确的文件夹中。在最终完成所有这些编辑并删除 TS 错误之后,我的构建仍然失败。我的 CMS 应用程序似乎找不到我的库中定义的任何模块、组件或服务。我的图书馆正在正确构建,并且似乎包含所有这些元素。
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '**\Webdictaat.Client\dist\core\core' in '**\Webdictaat.Client\projects\cms\src\app'
我的库包含一个 public_api.ts 看起来它工作正常但生成的 core.ts 文件不包含所有导出的成员。例如,位于public_api.d.ts第二行的wd-core.module
真正的问题:我在图书馆中做错了什么,并非所有成员都被导出?
//dist/core/public_api.d.ts
export * from './lib/avatar/avatar.component';
export * from './lib/wd-core.module';
export * from './lib/modal-component/modal-component.component';
export * from './lib/game-elements/game-elements.module';
export * from './lib/core/html-outlet.directive';
export * from './lib/services';
export * from './lib/models';
//dist/core/core.d.ts
//No wd-core.module :(
/**
* Generated bundle index. Do not edit.
*/
export * from './public_api';
export { BaseModalService as ɵg } from './lib/core/basemodal.service';
export { GroupByPipe as ɵv } from './lib/core/group-by.pipe';
export { ArraySortPipe as ɵw } from './lib/core/order-by.pipe';
export { ProcessTokenComponent as ɵx } from './lib/core/process-token.component';
export { DirtyGuard as ɵk } from './lib/core/security/dirty.guard';
export { wdApi as ɵb } from './lib/core/wd.service';
export { WdFilterPipe as ɵu } from './lib/core/wdfilter.pipe';
export { DialogComponent as ɵs } from './lib/dialog/dialog.component';
export { ModalComponentComponent as ɵy } from './lib/modal-component/modal-component.component';
export { NavMenuService as ɵm } from './lib/nav-menu/nav-menu.service';
export { AccountService as ɵa } from './lib/services/account.service';
export { AchievementService as ɵi } from './lib/services/achievement.service';
export { AssignmentService as ɵn } from './lib/services/assignment.service';
export { ConfigService as ɵd } from './lib/services/config.service';
export { DialogService as ɵe } from './lib/services/dialog.service';
export { DictaatService as ɵc } from './lib/services/dictaat.service';
export { GoogleAnalyticsEventsService as ɵq } from './lib/services/google-analytics.service';
export { ImageService as ɵh } from './lib/services/images.service';
export { ParticipantService as ɵo } from './lib/services/participantService';
export { PollService as ɵr } from './lib/services/poll.service';
export { QuizService as ɵf } from './lib/services/quiz.service';
export { RatingService as ɵj } from './lib/services/rating.service';
export { StylingService as ɵp } from './lib/services/styling.service';
export { VideoService as ɵl } from './lib/services/video.service';
export { SpinnerComponent as ɵt } from './lib/spinner/spinner.component';
完整的 Github 项目:
https://github.com/Webdictaat/Webdictaat.Client/tree/update6
图书馆项目
https://github.com/Webdictaat/Webdictaat.Client/tree/update6/projects/core
CMS 应用程序项目
https://github.com/Webdictaat/Webdictaat.Client/tree/update6/projects/cms