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.

Error: Angular JIT compilation failed: '@angular/compiler' not loaded!

See original GitHub issue

🐞 bug report

Affected Package

Not sure, but maybe @angular/compiler or @angular/cli

Is this a regression?

Yes it was working with angular 8 and I think angular 9. (I’ve migrated both in a row after doing some test in V9 to check it was working. But maybe I’ve missed something in my tests) I’m trying to complete migration, no compilation error, apps run in browser as long as I don’t set optimization build option in angular.json

Description

If I set "optimization": true in angular.json I have the following error in my browser (no compilation error even with AOT)

main-es2015.83cd1a7f2902ea042a79.js:1 Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.

πŸ”¬ Minimal Reproduction

Currently don’t manage to isolate where the issue comes from so I’m not able to create a reproduction sample repo. I know I have some custom bootstraping pre-process, but I don’t think that’s the issue Ivy is on (wasn’t in V8 and V9), OAT is and was on, optimization was on too when I was in V8

πŸ”₯ Exception or Error


main-es2015.83cd1a7f2902ea042a79.js:1 Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
  - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
  - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
  - Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
    at z (main-es2015.83cd1a7f2902ea042a79.js:1)
    at Function.get (main-es2015.83cd1a7f2902ea042a79.js:1)
    at We (main-es2015.83cd1a7f2902ea042a79.js:1)
    at cs (main-es2015.83cd1a7f2902ea042a79.js:1)
    at main-es2015.83cd1a7f2902ea042a79.js:1
    at os.processProvider (main-es2015.83cd1a7f2902ea042a79.js:1)
    at main-es2015.83cd1a7f2902ea042a79.js:1
    at main-es2015.83cd1a7f2902ea042a79.js:1
    at Array.forEach (<anonymous>)
    at we (main-es2015.83cd1a7f2902ea042a79.js:1)

🌍 Your Environment

Angular Version:


Angular CLI: 10.0.5
Node: 14.8.0
OS: win32 x64

Angular: 10.0.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1000.5
@angular-devkit/build-angular      0.1000.5
@angular-devkit/build-ng-packagr   0.1000.5
@angular-devkit/build-optimizer    0.1000.5
@angular-devkit/build-webpack      0.1000.5
@angular-devkit/core               10.0.5
@angular-devkit/schematics         10.0.5
@angular-devkit/schematics-cli     0.1000.5
@angular/cdk                       10.1.3
@angular/cli                       10.0.5
@angular/flex-layout               10.0.0-beta.32
@angular/http                      7.2.16
@angular/material                  10.1.3
@angular/material-moment-adapter   10.1.3
@angular/pwa                       0.1000.5
@ngtools/webpack                   10.0.5
@schematics/angular                10.0.5
@schematics/schematics             0.1000.5
@schematics/update                 0.1000.5
ng-packagr                         10.0.3
rxjs                               6.6.2
typescript                         3.9.7
webpack                            4.43.0

Anything else relevant?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Aug 17, 2020

@no-more - could you provide a runnable reproduction of this issue? It is very hard to debug just from the error message.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 19, 2020

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

Uncaught (in promise): Error: Angular JIT compilation failed
Error: Angular JIT compilation failed: '@angular/compiler' not loaded! - JIT compilation is discouraged for production use-cases! Consider AOTΒ ...
Read more >
Uncaught Error: Angular JIT compilation failed - GitHub
I'm building my app with Webpack and AngularCompilerPlugin. After compilation is done and I load the URL where the app is served I'm...
Read more >
How to fix Uncaught (in promise): Error: Angular JIT ...
How to fix Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! This error can occur in Angular and is actuallyΒ ......
Read more >
Quick Angular fix: the NgModule 'AppModule' needs to be ...
The NgModule 'AppModule' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. Github suggested that I upgraded to theΒ ......
Read more >
Might not be an Ionic issue but...Angular JIT compilation failed
Error: Angular JIT compilation failed: '@angular/compiler' not loaded! JIT compilation is discouraged for production use-cases!
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