1

我有一个工作区库,它给我一个错误,我不知道如何调试。

构建错误无法解析条目 (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 文件,并且我知道具体是哪个模块,通过将其包含在此处会导致问题。

该模块本身非常轻巧。

公共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]
    };
  }
}

那有什么问题?

4

1 回答 1

0

对此的修复是确保使用分发源进行模块导入。这些被添加到 tsconfig.ts 作为路径,例如

"paths": {
  "one": [
    "dist/one"
  ],
  "one/*": [
    "dist/one/*"
  ],
  "two": [
    "dist/two"
  ],
  "two/*": [
    "dist/two/*"
  ]

然后导入为:

import { OneModule } from "one";

确保您OneModule之前也成功构建TwoModule

于 2019-04-15T09:04:35.200 回答