Skip to content

App broken with a --prod build #10910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
umarov opened this issue May 18, 2018 · 8 comments
Closed

App broken with a --prod build #10910

umarov opened this issue May 18, 2018 · 8 comments

Comments

@umarov
Copy link

umarov commented May 18, 2018

Versions

Angular CLI: 6.0.3
Node: 10.1.0
OS: linux x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.6.3
@angular-devkit/build-optimizer   0.6.3
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cli                      6.0.3
@angular/pwa                      0.6.3
@ngtools/webpack                  6.0.3
@schematics/angular               0.6.3
@schematics/update                0.6.3
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.8.3

Target: es2016

Repro steps

Here is the repo for repro. It's deployed to github pages here

  • ng new --routing -p basic -S -g --style scss basic-angular-app
  • Update tsconfig.json to target ES2016. (Note: Problem happens with ES5 as well, I tried)
  • ng build --prod --output-path docs --base-href basic-angular-app
  • Git add and push to master branch
  • Blank white screen, check console to see error

Observed behavior

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

Desired behavior

App to just work and see the hello world screen with angular logo.

Mention any other details that might be useful (optional)

This is happening on my other project. It also lives in Github pages. You can see the same error there as well. It's broken in production.

@larssn
Copy link

larssn commented May 18, 2018

Related issue: #10658

@woutervddn
Copy link

woutervddn commented May 18, 2018

I experience the same issue with target: ES5

ng serve --prod is also not working

@filipesilva
Copy link
Contributor

Thanks for reporting this issue. However, this issue is a duplicate of an existing issue angular/devkit#816. Please subscribe to that issue for future updates.

@filipesilva
Copy link
Contributor

Note: you mentioned that this happens with ES5 as well but the error message shown (Must call super constructor) is something that only happens with Build Optimizer with ES2015.

If you get a different message with ES5, please let me know. If you get the same message on ES5, then one of the libraries you import must be exporting ES2015 and that is why it breaks on Build Optimizer.

You can disable Build Optimizer meanwhile though.

@umarov
Copy link
Author

umarov commented May 18, 2018

@filipesilva I get the exact same message in es5 target. I am just using the default generated app from angular cli, not extra libraries and no modification to the code itself. I will be following it on the devkit repo

@clydin
Copy link
Member

clydin commented May 18, 2018

Using the reproduction found above and changing the TS target to es5, resulted in the application working as expected with --prod. ES5 does not have classes so the only way to receive the error indicated above in that scenario would be if a third-party ES2015 library containing classes was used within the application.

In the "target": "es2016", case, disabling build optimizer results in a working application.

@umarov
Copy link
Author

umarov commented May 18, 2018

Only third party library seems to be rxjs.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants