1

I have a workspace library that is giving me an error I have no idea how to debug.

BUILD ERROR Could not resolve entry (C:_dev\my-app\presentation\angular-workspace\dist\my-app-ui\esm2015\my-app-ui.js) Error: Could not resolve entry (C:_dev\my-app\presentation\angular-workspace\dist\my-app-ui\esm2015\my-app-ui.js) at error (C:_dev\my-app\presentation\angular-workspace\node_modules\rollup\dist\rollup.js:3460:30) at C:_dev\my-app\presentation\angular-workspace\node_modules\rollup\dist\rollup.js:21474:17

It would help to understand what this error means. I know that the "entry point" for the library is its publi-api file and I know which module specifically, by including it here it causing the issue.

The module itself is pretty lightweight.

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";

edit I have narrowed it down to the inclusion of another library's module (directly not via 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]
    };
  }
}

what is wrong with that one??

JJJ
  • 32,902
  • 20
  • 89
  • 102
jenson-button-event
  • 18,101
  • 11
  • 89
  • 155

1 Answers1

0

The fix for this is to ensure to use the distribution source for module imports. these are added to tsconfig.ts as paths, e.g.

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

and then import as:

import { OneModule } from "one";

ensuring you also build OneModule successfully before TwoModule

jenson-button-event
  • 18,101
  • 11
  • 89
  • 155