Angular-cli: If we set buildOptimizer and aot to false, apllication throws error?

Created on 26 Jul 2019  路  8Comments  路  Source: angular/angular-cli

馃悶 Bug report

I have created an angular with ASP .NET Core sample. when i try to run my angular application only using below command it is working fine

ng serve --prod

But when i set buildOptimizer and aot to false application throws error

馃敟 Exception or Error

download (1)

My config:

download

馃敩 Minimal Reproduction

  1. Download sample

  2. goto ClientApp folder

  3. give npm i command

  4. then give ng serve --prod

You will see reported error in console window

馃實 Your Environment




 "@angular/animations": "6.1.10",
    "@angular/common": "6.1.10",
    "@angular/compiler": "6.1.10",
    "@angular/core": "6.1.10",
    "@angular/forms": "6.1.10",
    "@angular/http": "6.1.10",
    "@angular/platform-browser": "6.1.10",
    "@angular/platform-browser-dynamic": "6.1.10",
    "@angular/platform-server": "6.1.10",
    "@angular/router": "6.1.10",
devkibuild-angular help wanted investigation

Most helpful comment

The problem seems to be that you have optimization: true, Most likely there some non side effect code free which being removed.

All 8 comments

Hi @alan-agius4 ,

Do you have any idea about this, please share it

The problem seems to be that you have optimization: true, Most likely there some non side effect code free which being removed.

okay @alan-agius4 馃憤

If you run ng serve --prod --source-map you can see where the error comes from:
image

That being said, even with that extra information the best I can see is that something breaks inside that library. Maybe it's a bug somewhere...

Can you try with the latest Angular CLI though? You are using version 6 and a lot of changed since then. Maybe the problem has been fixed.

okay @filipesilva , i will try with angular 8.

If there is a bug in my library thenm why it works fine with optimization true

Using optimization set to true will try to remove unused code. Maybe the problematic code is removed and thus it doesn't error at runtime.

Closing as stale. If you're still having this problem with the latest versions let us know with a repro and we can reopen.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajjejosefsson picture rajjejosefsson  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

jbeckton picture jbeckton  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments