question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Angular AOT server doesn't play nicely with Bazel for LocationUpgradeModule

See original GitHub issue

๐Ÿž bug report

Affected Package

The issue is caused by the interaction of @angular/common/upgrade with the Bazel based AOT compiler.

Is this a regression?

No, this has not worked in any older versions.

Description

When you attempt to import `LocationUpgradeModule.config()` as a dependency you get a difficult error message that doesn't quite scan for me.

๐Ÿ”ฌ Minimal Reproduction

Iโ€™ve created a repo that has an approximately minimal reproduction. In this commmit I start loading LocationUpgradeModule.config() and UpgradeModule in my AppModule. However, when I add this, I get the following exception.

๐Ÿ”ฅ Exception or Error

Loading: 0 packages loaded
Analyzing: 14 targets (0 packages loaded, 0 targets configured)
INFO: Analyzed 14 targets (0 packages loaded, 0 targets configured).
INFO: Found 14 targets...
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[1 / 39] Compiling Angular templates (ngc) //my-app/src:src; 1s worker ... (2 actions running)
ERROR: /home/achew22/Projects/angular-bazel-demo/my-app/src/BUILD.bazel:27:1: Compiling Angular templates (ngc) //my-app/src:src failed (Exit 1)
Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'LocationUpgradeModule' was called.
: Unexpected value 'undefined' imported by the module 'AppModule in /home/achew22/.cache/bazel/_bazel_achew22/e93e1b7ac2af1e379678c6e725b6b9dc/execroot/project/my-app/src/app/app.module.ts'
Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'LocationUpgradeModule' was called.

INFO: Elapsed time: 6.126s, Critical Path: 5.22s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

๐ŸŒ Your Environment

Angular Version: I donโ€™t think ng version is the correct dep version, but I do have

    "@angular/bazel": "~8.1.0",

in my package.json, which I believe is the information you want.

Things Iโ€™ve done to try to fix it

I tried running this outside of the sandbox to see if that helped (it didnโ€™t), and I also tried turning on trace which didnโ€™t print any additional output. I would love to debug this myself, but I donโ€™t know how to even manipulate at the abstraction layer where this is happening. Sorry.

Anything else relevant?

@gregmagolan and @alexeagle since I think they are working on Angular/Bazel.

Thanks so much!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, May 28, 2020

I can confirm that installing @angular/upgrade and then removing

    "node_modules/@angular/common/upgrade*",
    "node_modules/@angular/router/upgrade*"

from the angular-metadata.tsconfig.json file does allow the installation and then ng build to complete successfully.

This seems like the right approach here.

0reactions
angular-automatic-lock-bot[bot]commented, Apr 14, 2022

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ahead-of-time (AOT) compilation - Angular
In this phase, the TypeScript compiler and AOT collector create a representation of the source. The collector does not attempt to interpret the...
Read more >
Angular Interview Questions โ€” You Must Know (2022) - Medium
We have collected over 200+ Angular Interview Questions from various ... can easily remember the things and perform well in your interview.
Read more >
Angular Interview Questions - GitHub | PDF | Angular Js | Class ...
1. What is Angular Framework? Angular is a TypeScript-based open-source front-end platform that makes it easy to build applications with in web/mobile/desktop.
Read more >
AngularFire - OSCHINA - ไธญๆ–‡ๅผ€ๆบๆŠ€ๆœฏไบคๆต็คพๅŒบ
AngularFire ๆ˜ฏFirebase ๅฎ˜ๆ–นๆ”ฏๆŒAngularJS ็ป‘ๅฎšFirebaseใ€‚Firebase ๆ˜ฏๅ…จๅŽ็ซฏ๏ผŒไธ้œ€่ฆๆœๅŠกๅ™จๅฐฑๅฏไปฅๆž„ๅปบไฝ ็š„Angular ๅบ”็”จใ€‚AngularFire ๆไพ›$firebase ๆœๅŠก๏ผŒย ...
Read more >
Angular 6 - AOT compilation on library to be used as lazily ...
I can't build the lib together with the main app as the final goal is having other developers create plugins for the app,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found