Skip to content

ng build v6 does not use paths section of root tsconfig.json #10444

Closed
@krotscheck

Description

@krotscheck

Versions

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.0.0-rc.5
Node: 8.11.1
OS: darwin x64
Angular: 6.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.5.7
@angular-devkit/build-angular      0.5.7
@angular-devkit/build-ng-packagr   0.5.7
@angular-devkit/build-optimizer    0.5.7
@angular-devkit/core               0.5.7
@angular-devkit/schematics         0.5.7
@angular/material                  5.2.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0-rc.5
@schematics/angular                0.5.7
@schematics/update                 0.5.7
rxjs                               6.0.0-uncanny-rc.7
typescript                         2.7.2
webpack                            4.5.0

Repro steps

  • Generate a new repository with 2 libraries in projects/*.
  • Library A must import Library B
  • Write and run unit test for Library A
  • run ng build.

Observed behavior

If running ng test, the project resolves /tsconfig.json at per each library's ./project/libraryA/tsconfig.spec.json. The root tsconfig.json has an automatically managed paths block, linked with the output directories.

Running ng build, it appears that we don't invoke ng-packagr using that tsconfig.json file, or even resolve the paths block, resulting in a slew of errors of this sort:

projects/libraryA/src/test.model.ts(18,29): error TS2307: Cannot find module 'libraryB'.

Desired behavior

It should be possible to provide a paths block for dependency resolution during the build step.

Mention any other details that might be useful (optional)

I'm working through a full migration on a public project here:
https://github.com/kangaroo-server/kangaroo-ui/tree/feature/ng6

Repro steps on that repo:

yarn install --pure-lockfile
yarn build # note that it has import failures on @kangaroo/angular-authn
yarn test angular-authn # This works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions