Skip to content

ng build ---prod with "optimization: true" causes browser error. #10658

Closed
@rafaelfgx

Description

@rafaelfgx

Versions

Angular CLI: 6.0.0
Node: 10.0.0
OS: win32 x64
Angular: ...

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2

Repro steps

  1. Create new Angular 6 project with "ng new app-test" command.
  2. Run "ng build ---prod" command.
  3. Host the "dist" generated folder on a http server, such as "http-server" (https://www.npmjs.com/package/http-server).
  4. Open the url in Chrome.

Observed behavior

Error: Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor.

1

If you change the optimization property from true to false in the angular.json file, and repeat the above steps, the application loads normally.

image

39658675-6402a382-4fee-11e8-8d5a-e862f4f50ccb

Desired behavior

The application should load correctly using optimization: true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions