Skip to content

Unable to run the application with enableIvy:false after upgrading to angular 12 #21017

@thutinavaneethreddy

Description

@thutinavaneethreddy

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Did this behavior use to work in the previous version?
Yes, the previous version in which this bug was not present was: 11.x.x

Description

I have an application which needs to be run with enableIvy and aot set to false. Hence in tsconfig.json, I have set :

"angularCompilerOptions": {
"enableIvy": false
}

and I have set aot to false in angular.json.

The application used to run fine before upgrading to 12. After upgrading to angular 12, while serving the application, it gives a warning saying : Project is attempting to disable the Ivy compiler. Angular versions 12 and higher do not support the deprecated View Engine compiler for applications. The Ivy compiler will be used to build this project.

And in console of the browser :
**Uncaught 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.**

How to run the applications in angular 12 with Ivy disabled?

🔬 Minimal Reproduction

In an existing application on angular 12,
set enableIvy to false in tsconfig and aot to false in angular.json
run ng serve
Application doesn't get compiled with enableIvy disabled and fails to load

🔥 Exception or Error

🌍 Your Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions