Skip to content

Unable to build angular library that contains another library #14296

@jamcoupe-ccl

Description

@jamcoupe-ccl

Current Behavior

When trying to build an angular library that references another library it fails because it's unable to find the files.

Expected Behavior

It should be able to build a buildable angular library with other library references.

Github Repo

No response

Steps to Reproduce

  1. See: add buildable angular library issue nx-examples#256
  2. Run yarn install
  3. Run nx run buildable-angular-library:build

Nx Report

$ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 18.12.1
   OS   : win32 x64
   yarn : 1.22.19

   nx : 15.4.0-rc.2
   @nrwl/angular : 15.4.0-rc.2
   @nrwl/cypress : 15.4.0-rc.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.4.0-rc.2
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.4.0-rc.2
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.4.0-rc.2
   @nrwl/js : 15.4.0-rc.2
   @nrwl/linter : 15.4.0-rc.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 15.0.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 15.4.0-rc.2
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.4.0-rc.2
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : 15.4.0-rc.2
   @nrwl/webpack : 15.4.0-rc.2
   @nrwl/workspace : 15.4.0-rc.2
   @nrwl/vite : 15.4.0-rc.2
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @ngrx/component-store: 15.0.0
         @ngrx/effects: 15.0.0
         @ngrx/entity: 15.0.0
         @ngrx/router-store: 15.0.0
         @ngrx/store: 15.0.0
         @ngrx/store-devtools: 15.0.0

Failure Logs

$ nx run buildable-angular-library:build

> nx run buildable-angular-library:build:production

Building Angular Package

------------------------------------------------------------------------------
Building entry point '@nx-example/buildable-angular-library'
------------------------------------------------------------------------------

 >  NX   libs/js-library/src/lib/js-library.ts:1:1 - error TS6059: File 'C:/Projects/nx-examples/libs/js-library/src/lib/js-library.ngtypecheck.ts' is not under 'rootDir' 'C:\Projects\nx-examples\libs\buildable-angular-library\src'. 'rootDir' is expected to contain all source files.


   1 export function jsLibrary(): string {
    
   libs/js-library/src/index.ts:1:1 - error TS6059: File 'C:/Projects/nx-examples/libs/js-library/src/index.ngtypecheck.ts' is not under 'rootDir' 'C:\Projects\nx-examples\libs\buildable-angular-library\src'. 'rootDir' is expected to contain all source files.

   1 export * from './lib/js-library';
    
   libs/js-library/src/index.ts:1:15 - error TS6059: File 'C:/Projects/nx-examples/libs/js-library/src/lib/js-library.ts' is not under 'rootDir' 'C:\Projects\nx-examples\libs\buildable-angular-library\src'. 'rootDir' is expected to contain all source files.

   1 export * from './lib/js-library';
                   ~~~~~~~~~~~~~~~~~~
   libs/buildable-angular-library/src/lib/buildable-angular-library/buildable-angular-library.component.ts:3:27 - error TS6059: File 'C:/Projects/nx-examples/libs/js-library/src/index.ts' is not under 'rootDir' 'C:\Projects\nx-examples\libs\buildable-angular-library\src'. 'rootDir' is expected to contain all source files.

   3 import { jsLibrary } from '@nx-example/js-library';
                               ~~~~~~~~~~~~~~~~~~~~~~~~

   Pass --verbose to see the stacktrace.


 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target undefined for project buildable-angular-library (11s)

    ×    1/1 failed
    √    0/1 succeeded [0 read from cache]

   View structured, searchable error logs at https://cloud.nx.app/runs/d5F4Gj5I1G

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions