Questions tagged [angular-jit]

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

An Angular application consists largely of components and their HTML templates. Before the browser can render the application, the components and templates must be converted to executable JavaScript by an Angular compiler.

Angular offers two ways to compile your application:

  • Just-in-Time (JIT), which compiles your app in the browser at runtime

  • Ahead-of-Time (AOT), which compiles your app at build time.

JIT compilation is the default when you run the build-only or the build-and-serve-locally CLI commands:

ng build

ng serve 

For AOT compilation, append the --aot flags to the build-only or the build-and-serve-locally CLI commands:

ng build --aot

ng serve --aot

For more information about Angular compilers read the official documentation

12 questions
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
3 answers

issue on angular production build on angular 9 migrate

hello Everyone, i am getting issue on angular after migration, I have migrated the project to angular 9 from angular 8 . the angular with ng server --prod works in version 8 but on version 9 i am getting error . i have checked with ng build…
6
votes
2 answers

Dynamically compiled lazy loaded dynamic routes in Angular causing 'unsafe-eval' error

In the index.html file of the angular application after applying the Content Security Policy, the application is giving 'unsafe-eval' console error as below - core.js:4442 ERROR Error: Uncaught (in promise): EvalError: Refused to evaluate a string…
Himanshu
  • 2,251
  • 4
  • 20
  • 25
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…
3
votes
1 answer

How can I configure my Angular app to use CLI for production and JIT for development?

goal With one unified code base, I want to be able to... compile with CLI and serve the entire app with the resulting bundled files use JIT compilation and serve the app with each file having it's own network request (no bundling) current…
bnieland
  • 6,047
  • 4
  • 40
  • 66
2
votes
1 answer

Is there a way to include the JIT compiler with an AOT angular 6/7 build?

I need to the ability to dynamically create modules and components ( with different templates) during runtime with a production build (aot enabled). I know this is possible with dev builds where the JIT compiler is used. But i don't want this for my…
kugar
  • 129
  • 1
  • 1
  • 6
2
votes
0 answers

How to attach a [formControl] to an type when instantiating it in Angular

I am trying to attach a [formControl] (and other top level attributes) to an object that I create with a ComponentFactoryResolver in order to handle the form logic with a ControlValueAccessor. Basically I do this: @Component({selector:…
jsgoupil
  • 3,788
  • 3
  • 38
  • 53
1
vote
0 answers

Why Angular JIT Compiler Mode is not catching template error

I am running a simple application in angular 12.2.0 app.component.ts file: import { Component} from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class…
Kavar Rushikesh
  • 143
  • 1
  • 10
1
vote
0 answers

Angular 9: failed to build an angular library in v9.1.0 which dependes on other angular library

I'm upgrading my Angular library to version 9, in my project I use Angular v9.1.0. And my library relies on another internal Angular library. When I try to build my library, II got the following…
Chris Bao
  • 2,418
  • 8
  • 35
  • 62
1
vote
0 answers

Why angular app with embedded app throws an error Runtime compiler is not loaded in AOT mode?

I'm using an old gwt application in angular app. I had no better idea than past gwt app into assets dir and specify script with entry point in index.html In dev mode everything works well that's why I didn't suspect any bad thing. But after build…
vicpro
  • 428
  • 1
  • 6
  • 14
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
1 answer

transform HTML string to Angular Components

let's say we do an API call and get some HTML DOM in a String. The content comes as HTML without angular, so I have first to transform it to Angular where I want and then compile it as angular. Example API response:
...some more html...

a…