-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Bazel: Missing c'tor dependency in ng_module rule results in unfriendly error message #27125
Copy link
Copy link
Closed
Labels
area: bazelIssues related to the published `@angular/bazel` build rulesIssues related to the published `@angular/bazel` build rulesfreq2: mediumtype: bug/fix
Milestone
Description
When declaring a dependency in the constructor of a component that will be injected by DI, but not including a reference to that in the ng_module rule in the Bazel BUILD file, it will result in an unfriendly error message.
It took me a while to realise what I had missed here.
Error:
ERROR: /Users/matt/Documents/workspace/evertz/internal/tooling/haystack/site2/login/BUILD:9:1: Compiling Angular templates (ngc) //internal/tooling/haystack/site2/login:login failed (Exit 1)
: TypeError: Cannot read property 'isSkipSelf' of null
at ProviderElementContext._getDependency (/private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18426:22)
at /private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18371:64
at Array.map (<anonymous>)
at /private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18371:30
at Array.map (<anonymous>)
at ProviderElementContext._getOrCreateLocalProvider (/private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18349:67)
at /private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18247:27
at Array.forEach (<anonymous>)
at new ProviderElementContext (/private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:18244:53)
at TemplateParseVisitor.visitElement (/private/var/tmp/_bazel_matt/9798d96861c6aafe168f904aab7390d7/execroot/evertz/bazel-out/host/bin/external/angular/@angular/bazel/ngc-wrapped.runfiles/npm/node_modules/@angular/compiler/bundles/compiler.umd.js:19728:35)
Target //internal/tooling/haystack/site2:devserver failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 68.118s, Critical Path: 47.01s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
INFO: 24 processes: 2 darwin-sandbox, 22 worker.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully
Using Angular version 7.0.2
http_archive(
name = "angular",
url = "https://github.com/angular/angular/archive/7.0.2.zip",
strip_prefix = "angular-7.0.2",
)
In this example, the AuthService was missing as a dep.
export class LoginComponent implements OnInit {
constructor(private authService: AuthService) {}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: bazelIssues related to the published `@angular/bazel` build rulesIssues related to the published `@angular/bazel` build rulesfreq2: mediumtype: bug/fix