Angular-cli: Build got failed while using 'ng build ---aot'

Created on 10 Jun 2019  Β·  9Comments  Β·  Source: angular/angular-cli

🐞 Bug report

Command (mark with an x)


- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

NO

Description

I have set "target": "es6", when i try to serve my application using below command

ng serve ---aot

It throws below error:

Screenshot (269)

If i change target to "es2015" and try to run using below commands

ng serve --prod

ng serve --aot

it throws a same error:

Screenshot (271)

Working fine

When using "ng serve" with target es2015 and es6

And all commands are working fine with target as es5

πŸ”¬ Minimal Reproduction

  1. Download sample
    angularIssue.zip

  2. Run "npm i"

  3. The give anyone command from below list:

    • ng serve --aot
    • ng build --aot
    • ng serve --prod
    • ng build --prod

πŸ”₯ Exception or Error

Screenshot (271)

🌍 Your Environment

"@angular-devkit/build-angular": "^0.800.2",
"@angular-devkit/build-optimizer": "^0.800.2",
"@angular/cli": "~8.0.0",
"@angular/compiler-cli": "~8.0.0",
low broken bufix

Most helpful comment

At first it thought it was caused by Build Optimizer based on the above screenshots but it seems that it also fails when not using Build Optimizer.

All 9 comments

At first it thought it was caused by Build Optimizer based on the above screenshots but it seems that it also fails when not using Build Optimizer.

Hi @alan-agius4 ,

While using Below three commands build-optimizer must be used

ng serve --aot
ng build ---prod

-β€”aot doesn’t use build optimizer by default only β€”-prod does.

Hi @alan-agius4 ,

the issue occurs only when i providing something in "providers"

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { GridModule, PageService } from '@syncfusion/ej2-angular-grids';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, GridModule],
  providers: [PageService],
  bootstrap: [AppComponent]
})
export class AppModule {}

if i give like below it is working fine

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { GridModule, PageService } from '@syncfusion/ej2-angular-grids';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, GridModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

I have only provided service but i didn't use in my application level

The same issue persists in the latest release also

"@angular/animations": "~8.1.0-next.2",
"@angular/common": "~8.1.0-next.2",
"@angular/compiler": "~8.1.0-next.2",
"@angular/core": "~8.1.0-next.2",
"@angular/forms": "~8.1.0-next.2",
"@angular/platform-browser": "~8.1.0-next.2",
"@angular/platform-browser-dynamic": "~8.1.0-next.2",
"@angular/router": "~8.1.0-next.2",

Hi @alan-agius4 ,

Reported issue got resolved in latest release version 8.2.0

HI @alan-agius4

Still I am facing same issue, can you please re-consider this issue.

Thanks.

Looks like duplicate of https://github.com/angular/angular-cli/issues/15392. Please provide minimal demo so we can reproduce the problem.

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