-
Notifications
You must be signed in to change notification settings - Fork 12k
ng build ---prod with "optimization: true" causes browser error. #10658
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
Comments
@rafaelfgx see here |
@yokots With build target es2017 or esnext the same error occurs. |
See also here |
Related webpack issue: webpack-contrib/uglifyjs-webpack-plugin#269 |
Also seeing this issue with Angular 6. Confirmed that setting optimization to false in angular.cli works around the problem. Though this has increased my main bundle size from 2M to 6.9M, so it's not a practical workaround. |
Targeting ES5 also works around the problem for me. I was targeting ES6 previously. |
With the greatest respect, this is the second breaking problem with ES6 output by the CLI in as many months (there was also a build optimizer issue having to do with WebPack - see #9495). It would seem that ES6 is not one of the test cases when bringing the CLI to GA. If my summation is correct, may I humbly suggest that a test case be added so that seemingly obvious issues such as this are caught prior to developers undertaking the work of upgrading? And may I add, fine work overall; Angular's trajectory is fantastic - it's just frustrating having to deal with ES6 output issues again. |
I have configured the {
...
"target": "es5",
...
} I'm experiencing this problem too, even with ES5. So this problem is not exclusive to ES6. (I mean |
The build optimizer currently does not fully support ES2015+. There is ongoing work to provide this support. Current recommendation is to disable it unless using ES5. Duplicate of angular/devkit#816 |
Disabling the buildOptimizer worked for me. I'm on the latest version and also targeting es5. Having the buildOptimizer set to true is literally stripping out a portion of code from a library I'm using. This causes undefined errors to be thrown. It's microsoft's own msal npm package and the portion that's being stripped out is their AuthorityType enum. |
Updating to Angular 7 rc0 fixed this for me. See my comment on another thread |
After a few days of wasting time I found that my angular elements webcomponent that should work in IE11 is getting "Function Expected" error because of angular cli optimization: true. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
Observed behavior
Error: Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor.
If you change the optimization property from true to false in the angular.json file, and repeat the above steps, the application loads normally.
Desired behavior
The application should load correctly using optimization: true.
The text was updated successfully, but these errors were encountered: