Questions tagged [angular-aot]

A AOT-Compiler (Ahead of time) compiles the source code before the code is executed. Unlike the JIT-Compiler (Just in time) which compiles right when the code is executed.

The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the browser downloads and runs that code.

This guide explains how to build with the AOT compiler using different compiler options and how to write Angular metadata that AOT can compile.

To find more information :

176 questions
1
vote
1 answer

Angular AoT Compilation

I was going through updated Angular docs and have found that they have changed their approach now. Earlier it was as follows: run ng eject command to generate webpack.config.js. create webpack.config.aot.js, main-aot.ts, tsconfig-aot.json,…
Devesh Jadon
  • 7,004
  • 4
  • 22
  • 27
1
vote
1 answer

Angular2+ AOT application opens new tab in browser while navigating to a new route (sub route)

We have an application now running in angular2+. we recently started to use AOT ,since then we are seeing a strange behaviour. if we click on any link with routing (child routes) it will open a new tab for once, if we keep the newly opened tab then…
Amarnath R Shenoy
  • 5,121
  • 8
  • 24
  • 32
0
votes
0 answers

Which of JIT or AOT for local dev server to increase developer productivity?

Context Angular CLI: 14.2.5 Node: 16.18.0 Package Manager: npm 8.19.2 Angular: 14.2.5 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... pwa, router,…
Gaël N.
  • 121
  • 8
0
votes
0 answers

Cannot read property 'type' of null An unhandled exception occurred: Cannot read property 'type' of null

So we are using angular 9 , we are applying scope to all our library project in our organization. So in order to do so , I updated my existing library pacakge.json project name with @myorgname/lib_name. And changed imports everywhere i was using…
0
votes
0 answers

Ineffective mark compact near heap limit allocation failed when "aot=true"

I am trying to make a build of my angular application on 1vCPU and 1GB memory machine, ]it worked fine at start but as project is getting bigger, it fails with the error "Javascript heap out of memory" But, when aot=false is set, it works…
Charmi
  • 15
  • 5
0
votes
0 answers

Angular AOT and CSR: What is the overall process like?

so I'm a little bit confused about the sequence of actions during build, specifically Angular's AOT compiler and how/where/what it does in the CSR process and which steps happens at the build/server/client.. This is how I understood it so far: 1-…
0
votes
0 answers

How to load templateUrl dynamically in a Component in Angular 13 AOT?

I am trying to dynamically load template url dyanmically in angular AOT https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html Used code but not working ngAfterViewInit(): void { const moduleName =…
Aman Jain
  • 384
  • 1
  • 3
  • 15
0
votes
1 answer

Angular 13 ng serve with aot: true has incorrect map files

I upgraded from Angular 9 to Angular 13 with an Ivy compiler. By default, AOT is not set to true. When I run ng build with source maps on, everything works correctly and I can set breakpoints that are hit correctly. When I run ng serve, the…
Gabe
  • 122
  • 5
0
votes
1 answer

"TypeError: Assinging value to read-only", but only happens on AOT

I have a relatively old project of mine, originally made in Angular 7, I recently got motivated, updated it to 13, and I was able to make everything work... At least while developing. (I had actually upgraded it to Angular 10 about half a year ago,…
ssj4maiko
  • 41
  • 5
0
votes
1 answer

AOT compilation in Angular 12

Angular documentation states: *Ahead-of-Time (AOT), which compiles your application and libraries at build time. This is the default since Angular 9.* So if I want to compile for production my Angular 12 application with AOT I just need to type…
Matt
  • 265
  • 4
  • 17
0
votes
1 answer

Angular component with dynamic template created using ɵcompileComponent (Angular 9) is not working in production mode

I am creating a dynamic component in Angular 9. I have a
0
votes
0 answers

"Please add a @NgModule annotation" error... on something that has @NgModule annotation

I've found other posts on this subject, but my issues aren't the same. I can avoid this issue entirely by turning off AOT compilation. I'm using Angular 11. In code that had been working before Angular 11, I had some providers defined like this: …
kshetline
  • 12,547
  • 4
  • 37
  • 73
0
votes
1 answer

Can't resolve 'primeng/components/utils/ObjectUtils'

I migrated my project from angular 4 to angular 6 it is running well on localhost but at AOT-build time it gets an error like: ERROR in ./aot/app/home/accountant/customercost-form.component.ngfactory.ts Module not found: Error: Can't resolve…
0
votes
2 answers

Configuring angular production files after build

I have an angular 9 project which is part of an application suite installer [Wix installer]. One of the settings used by the angular app is the address of API which it fetches its data from some configurable address. I know that I can have many…
MHOOS
  • 5,146
  • 11
  • 39
  • 74
0
votes
1 answer

Raising compile time error depending on the value of environment variables

How can I raise a compiler time error in angular so the compiler will not proceed and give me error depending on the values inside my enviroments.ts file. For instance consider the following scenario in which the application should use either…
MHOOS
  • 5,146
  • 11
  • 39
  • 74