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
54
votes
4 answers

AOT - Angular 6 - Directive SomeComponent, Expected 0 arguments, but got 1. for self made Component

I am facing issue when i want to compile my current project in AOT with following package version : @ngtools/webpack@6.0.3 @angular@latest (6.0.2) Webpack@4.0.0 my webpack and tsconfig.json configuration can be find here I have facing some issue…
Yanis-git
  • 7,737
  • 3
  • 24
  • 41
22
votes
4 answers

Angular AOT compilation error "cannot determine module for class Component''

I have an Angular (4.3.2) application on which I want to perform an AOT build. App was created using @angular/cli. I have two components scaffolded with ng generate and a module in which both are included as a declaration: import {PrivateComponent}…
Armen Vardanyan
  • 3,214
  • 1
  • 13
  • 34
13
votes
1 answer

_lazy_route_resource lazy namespace object

I'm using angular compiler: const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin; With these compiler options: "angularCompilerOptions": { "genDir": "./build/compiled", "outDir": "./build/compiled", "skipMetadataEmit":…
Usman Aziz
  • 131
  • 1
  • 5
13
votes
3 answers

Angular 5.2 AOT build error Expected 0 arguments, but got 1 when using $event

I am capturing output event in method without parameter and it's working fine. but when i try to build AOT --prod getting folloing error. Expected 0 arguments, but got 1 Html code: SaveSortOrder($event) backend code: SaveSortOrder() {}
Md Ghouse
  • 301
  • 1
  • 3
  • 10
10
votes
3 answers

How to make Route data typed in Angular 7 (in production)?

import { environment } from '@env/environment'; export const routes: Routes = [ { path: '', children: [ { path: 'organisations', component: OrganisationListComponent, data: { …
displayName
  • 986
  • 16
  • 40
10
votes
2 answers

Angular 5 webpack 3 aot

I'm trying to make an aot build with webpack 3 and angular 5, but there are so many tutorials on the net and none show complete example without questions, so far I've got the following configuration: (For those who have questions about paths - I use…
Dmytro Grynets
  • 923
  • 11
  • 29
10
votes
1 answer

How to force npm to flatten dependencies?

I have a project in which several frontends sharing a common lib. The module dependencies of those projects are managed by npm. So, in the package.json of each of those projects I have : "dependencies": { "mylib":…
Ludovic Pénet
  • 1,136
  • 1
  • 16
  • 32
9
votes
2 answers

angular AOT and JIT on same project

On angular5, i try to have on same project AOT compilation for most of my module/component... but i have one part who need to be JIT compiled. For this second part, HTML come from Ajax request and contain some component tag who must be compiled by…
Yanis-git
  • 7,737
  • 3
  • 24
  • 41
8
votes
4 answers

Is it okay to mark a @ViewChild as private?

Is it okay to mark a ViewChild as private, if it's not being referenced in the template? I have been able to do this, then build and serve with the '--prod' flag, and encountered no errors. I'm currently using Angular 7. @ViewChild(HelloComponent)…
8
votes
6 answers

Angular library build error: TypeError: Cannot read property 'type' of null

In Angular v6, when attempting to build my library I am running into an extremely non-descriptive BUILD ERROR Cannot read property 'type' of null BUILD ERROR Cannot read property 'type' of null TypeError: Cannot read property 'type' of null at…
John
  • 9,249
  • 5
  • 44
  • 76
7
votes
0 answers

Using both AOT and JIT in production within an Angular 9 app

So I have been building an Angular 9 app where there is a customer dashboard to manage their templates which are saved on the server. Those templates can be viewed on different devices through an activation system so the devices are bound to the…
Billy Cottrell
  • 443
  • 5
  • 20
7
votes
2 answers

Angular Library which is used by another app produces error: Function calls are not supported in decorators but 'LoggerModule' was called

I wrote an angular library with some services to use this in different angular applications. Everything works fine without --prod, so without AOT compile, in the angular application. Generating the library with ng-packagr as well as with the cli as…
JV3
  • 872
  • 2
  • 9
  • 21
6
votes
1 answer

svg's won't load in production mode

All my svg's work perfectly in dev mode, as soon as I run `ng build --prod --aot" they are not loading. They all fallback to the png image. I can't figure out how to fix it. I have been on github already, and tried absolute paths relative…
FussinHussin
  • 1,718
  • 4
  • 19
  • 39
6
votes
0 answers

How to troubleshoot Angular-cli build when no error are thrown

I just upgraded my Angular application to version 5, which worked fine. However, once I upgraded a few other things (like @angular/cdk, @angular/material, typescript) I had to fix a bunch of bugs that came with the upgrade. Everything seems totally…
Kevin LeStarge
  • 8,142
  • 4
  • 21
  • 34
5
votes
1 answer

Is there any advantage of using JIT compilation in Angular in favor of using AOT?

The Angular docs specify several reasons for using AOT compilation in favor of JIT: Faster rendering Fewer asynchronous requests Smaller Angular framework download size Detect template errors earlier Better security However, when looking for…
1
2 3
11 12