Angular-cli: @angular-devkit/build-angular:v0.803.4 build fails for differential loading with optimization=true

Created on 12 Sep 2019  Β·  7Comments  Β·  Source: angular/angular-cli

🐞 Bug report

Command (mark with an x)


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

Is this a regression?


Yes, the previous version in which this bug was not present was:
@angular-devkit/build-angular:v0.803.3

Description

A clear and concise description of the problem...

Build fails with the latest @angular-devkit/build-angular:v0.803.4 if optimization is enabled i.e.
ng build --optimization=true

πŸ”¬ Minimal Reproduction

I tried to create a new app to reproduce it without success yet and I am afraid I cannot share the repo either.
But I did some digging and it seems related to fix 7a75c4cd215f06986b31afd85018ba918533a38d and differential loading. If I set my browserlist to last 1 Chrome versions the build is OK.

πŸ”₯ Exception or Error




[error] SyntaxError: /home/panos/ui/dist/vendor-es2015.js: Unexpected reserved word 'arguments' (1:2704314)

> 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[21],{"/Co4":function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return MatAutocomplete}),__webpack_require__.d(__webpack_exports__,"b",function(){return MatAutocompleteModule}),__webpack_require__.d(__webpack_exports__,"c",function(){return MatAutocompleteTrigger});var _angular_cdk_a11y__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("5GAg"),_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("KCVW"),_angular_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("8Y7J"),_angular_material_core__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("Xd0L"),_angular_cdk_bidi__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("IP0z"),_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("dvZr"),_angular_cdk_overlay__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("QQfA"),_angular_cdk_platform__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("/HVE"),_angular_cdk_portal__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("zMNK"),_angular_cdk_scrolling__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("hOhj"),_angular_common__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("SVse"),_angular_forms__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("s7LF"),_angular_material_form_field__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("HsOI"),

🌍 Your Environment




Angular CLI: 8.3.4
Node: 12.10.0
OS: linux x64
Angular: 8.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.4
@angular-devkit/build-angular     0.803.4
@angular-devkit/build-optimizer   0.803.4
@angular-devkit/build-webpack     0.803.4
@angular-devkit/core              8.3.4
@angular-devkit/schematics        8.3.4
@angular/cdk                      8.2.0
@angular/cli                      8.3.4
@angular/flex-layout              8.0.0-beta.27
@angular/material                 8.2.0
@ngtools/webpack                  8.3.4
@schematics/angular               8.3.4
@schematics/update                0.803.4
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

devkibuild-angular low regression bufix

All 7 comments

If possible could you try changing lines 261 & 274 in
node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js
to read ecma: 5, instead of ecma: wco.supportES2015 ? 6 : 5,?

Also could you provide the output of either npm ls terser or yarn list --pattern terser?

@clydin yes it did the trick, no errors after your suggested edits

The output of npm ls terser

[email protected] /home/panos/ui
└─┬ @angular-devkit/[email protected]
  β”œβ”€β”€ [email protected] 
  └─┬ [email protected]
    └── [email protected]  deduped

Thanks for looking into this and let me know if you need any more info.

I have just updated build-angular too and it fails with the same message (also it is printing the whole minified string main.js bundle in the console - one gigantic string - which is not useful at all).
We are using Heap and Smartlook analytics, and it's their official init scripts in our index.html files that are failing because they do use "arguments" keyword.

Having the same issue with our application after finally upgrading it from Angular 7 to 8.
When I changed the lines in common.js to ecma: 5, per @clydin comment, the build executed without any errors.

I'm still hitting this problem in v0.803.5 and no later version appears to be available on NPM - is that expected? For now I've just rolled back to v0.803.3.

Patch releases are generally released every Wednesday. This will be in .6.

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

NCC1701M picture NCC1701M  Β·  3Comments

delasteve picture delasteve  Β·  3Comments

IngvarKofoed picture IngvarKofoed  Β·  3Comments

rajjejosefsson picture rajjejosefsson  Β·  3Comments

naveedahmed1 picture naveedahmed1  Β·  3Comments