Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Feature Request: tsConfig option for ng-packagr in angular.json library build #674

Closed
@leo6104

Description

@leo6104

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Area

- [x] devkit
- [ ] schematics

Versions

0.5.5>=

Repro steps

We create tsconfig.json in same folder with ng-package.json file, but ng-packagr with angular-cli don't compile with the tsconfig.json file.

The log given by the failure

BUILD ERROR
projects/mapia-core/src/module/post/page/post-write.component.ts(6,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.
projects/mapia-core/src/module/post/page/post-modify.component.ts(5,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.
projects/mapia-core/src/module/profile/edit.component.ts(5,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.

Error: projects/mapia-core/src/module/post/page/post-write.component.ts(6,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.
projects/mapia-core/src/module/post/page/post-modify.component.ts(5,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.
projects/mapia-core/src/module/profile/edit.component.ts(5,41): error TS2307: Cannot find module '@mapiacompany/mapia-uploader'.

    at Object.<anonymous> (xxx/node_modules/ng-packagr/lib/ngc/compile-source-files.js:69:35)
    at Generator.next (<anonymous>)
    at xxx/node_modules/ng-packagr/lib/ngc/compile-source-files.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (xxx/node_modules/ng-packagr/lib/ngc/compile-source-files.js:3:12)
    at Object.compileSourceFiles (xxx/node_modules/ng-packagr/lib/ngc/compile-source-files.js:19:12)
    at Object.<anonymous> (xxx/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:37:60)
    at Generator.next (<anonymous>)
    at xxx/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:7:71
    at new Promise (<anonymous>)

Desired functionality

https://github.com/angular/devkit/blob/master/packages/angular_devkit/build_ng_packagr/src/build/index.ts#L50
It might be great if we add withTsConfig function at this line.
.withTsConfig(options.tsConfig)

Mention any other details that might be useful

we need to set "paths" in tsconfig.json for external library (managed in same repository)

    "paths": {
      "@mapiacompany/image-viewer": ["../image-viewer/index.ts"],
      "@mapiacompany/mapia-uploader": ["../mapia-uploader/index.ts"]
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions