我有一个工作区库,给我一个错误,我不知道如何调试。
BUILD ERROR无法解析输入 (C:_dev \ my-app \ presentation \ angular-workspace \ dist \ my-app-ui \ esm2015 \ my-app-ui.js) 错误:无法解析输入 (C:_dev \ my-app \ presentation \ angular-workspace \ dist \ my-app-ui \ esm2015 \ my-app-ui.js) 错误(C:_dev \ my-app \ presentation \ angular-workspace \ node_modules \ rollup \ dist \ rollup.js:3460:30) 在C:_dev \ my-app \ presentation \ angular-workspace \ node_modules \ rollup \ dist \ rollup.js:21474:17
这将有助于理解此错误的含义。我知道该库的“入口点”是其publi-api文件,并且通过将其包含在此处会导致问题,我知道具体使用哪个模块。
该模块本身非常轻巧。
public-api:
export * from "./lib/global-assets/models";
export * from "./lib/global-assets/global-assets.module";
export * from "./lib/global-assets/global-assets.service";
export * from "./lib/top-banner/models";
export * from "./lib/top-banner/top-banner.module";
export * from "./lib/top-banner/top-banner.service";
export * from "./lib/top-banner/components/top-banner/top-banner.component";
export * from "./lib/top-banner/components/apps-menu/apps-menu.component";
export * from "./lib/top-banner/components/top-banner-toggle/top-banner-toggle.component";
修改 我将范围缩小到包含另一个库的模块(直接不通过public-api)
import { NgModule, ModuleWithProviders } from "@angular/core";
import { AuthService } from "./auth.service";
@NgModule({
providers: [AuthService]
})
export class AuthModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: AuthModule,
providers: [AuthService]
};
}
}
那是怎么了?
答案 0 :(得分:0)
此问题的解决方法是确保使用分发源进行模块导入。这些作为路径添加到tsconfig.ts中,例如
"paths": {
"one": [
"dist/one"
],
"one/*": [
"dist/one/*"
],
"two": [
"dist/two"
],
"two/*": [
"dist/two/*"
]
,然后导入为:
import { OneModule } from "one";
确保您还可以在OneModule
之前成功构建TwoModule