Skip to content

ngc does not support relative rootDir via cli #36290

@Toxicable

Description

@Toxicable

🐞 bug report

Affected Package

@angular/compiler-cli

Is this a regression?

nope

Description

I'm attempting to use ngc under bazel using the ts_project rule and replacing tsc with ngc.
In order to do this most of the command line args need to equal in both ngc and tsc, however it would appear that rootDir is is treated differently under ngc.
Thee fix here would be to make rootDir resolve an absolute path from the processes cwd, as seen here https://github.com/bazelbuild/rules_nodejs/pull/1619/files#diff-5eb8729ae1c44d09b4ddc25c90585b9a this fixes the issue

🔬 Minimal Reproduction

See https://github.com/bazelbuild/rules_nodejs/pull/1619/files

🔥 Exception or Error


bazel-out/host/bin/external/npm/@angular/compiler-cli/bin/ngc.sh --project libs/ng-lib/tsconfig.json --outDir bazel-out/k8-fastbuild/bin/libs/ng-lib --rootDir libs/ng-lib --declarationDir

Error: Internal Error: absoluteFrom(libs/ng-lib): path is not absolute
    at Object.absoluteFrom (/home/fabian/.cache/bazel/_bazel_fabian/5e7b9b87f8c35ad8c8393b2c59738c12/execroot/build_bazel_rules_nodejs/_tmp/07c12d54970c8cddb1ddf80282a55151/_bazel_fabian/99d3dc50f0bae3830149c02defd9a6fa/sandbox/linux-sandbox/6/execroot/angular_bazel_architect/bazel-out/host/bin/external/npm/@angular/compiler-cli/bin/ngc.sh.runfiles/npm/node_modules/@angular/compiler-cli/src/ngtsc/file_system/src/helpers.js:29:19)

🌍 Your Environment

Angular Version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: compilerIssues related to `ngc`, Angular's template compilerfreq1: lowstate: confirmedtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions