Unable to run the application with enableIvy:false after upgrading to angular 12
π Bug report
Command (mark with an x)
- [ ] new
- [x] build
- [x] 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
Since version 12, using the deprecated rendering engine, VE instead of Ivy to build your application is no longer possible. Ivy is the only way!
With regards to the errors in the browser, it's hard to tell why, without a reproduction. Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
This might be related to your directory structure so its really important to get an accurate repro to diagnose this.
The errors in the browser disappeared when I enabled aot. Previously aot was set to false. I am able to run the application without any issues now after setting aot to true. Closing the issue
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.