Skip to content
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

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

Closed
loremaps opened this issue Sep 12, 2019 · 7 comments · Fixed by #15602
Labels
Milestone

Comments

@loremaps
Copy link

🐞 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 7a75c4c 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)

�[0m�[31m�[1m>�[22m�[39m�[90m 1 | �[39m(window�[33m.�[39mwebpackJsonp�[33m=�[39mwindow�[33m.�[39mwebpackJsonp�[33m||�[39m[])�[33m.�[39mpush([[�[35m21�[39m]�[33m,�[39m{�[32m"/Co4"�[39m�[33m:�[39m�[36mfunction�[39m(module�[33m,�[39m__webpack_exports__�[33m,�[39m__webpack_require__){�[32m"use strict"�[39m�[33m;�[39m__webpack_require__�[33m.�[39md(__webpack_exports__�[33m,�[39m�[32m"a"�[39m�[33m,�[39m�[36mfunction�[39m(){�[36mreturn�[39m �[33mMatAutocomplete�[39m})�[33m,�[39m__webpack_require__�[33m.�[39md(__webpack_exports__�[33m,�[39m�[32m"b"�[39m�[33m,�[39m�[36mfunction�[39m(){�[36mreturn�[39m �[33mMatAutocompleteModule�[39m})�[33m,�[39m__webpack_require__�[33m.�[39md(__webpack_exports__�[33m,�[39m�[32m"c"�[39m�[33m,�[39m�[36mfunction�[39m(){�[36mreturn�[39m �[33mMatAutocompleteTrigger�[39m})�[33m;�[39m�[36mvar�[39m _angular_cdk_a11y__WEBPACK_IMPORTED_MODULE_0__�[33m=�[39m__webpack_require__(�[32m"5GAg"�[39m)�[33m,�[39m_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_1__�[33m=�[39m__webpack_require__(�[32m"KCVW"�[39m)�[33m,�[39m_angular_core__WEBPACK_IMPORTED_MODULE_2__�[33m=�[39m__webpack_require__(�[32m"8Y7J"�[39m)�[33m,�[39m_angular_material_core__WEBPACK_IMPORTED_MODULE_3__�[33m=�[39m__webpack_require__(�[32m"Xd0L"�[39m)�[33m,�[39m_angular_cdk_bidi__WEBPACK_IMPORTED_MODULE_4__�[33m=�[39m__webpack_require__(�[32m"IP0z"�[39m)�[33m,�[39m_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_5__�[33m=�[39m__webpack_require__(�[32m"dvZr"�[39m)�[33m,�[39m_angular_cdk_overlay__WEBPACK_IMPORTED_MODULE_6__�[33m=�[39m__webpack_require__(�[32m"QQfA"�[39m)�[33m,�[39m_angular_cdk_platform__WEBPACK_IMPORTED_MODULE_7__�[33m=�[39m__webpack_require__(�[32m"/HVE"�[39m)�[33m,�[39m_angular_cdk_portal__WEBPACK_IMPORTED_MODULE_8__�[33m=�[39m__webpack_require__(�[32m"zMNK"�[39m)�[33m,�[39m_angular_cdk_scrolling__WEBPACK_IMPORTED_MODULE_9__�[33m=�[39m__webpack_require__(�[32m"hOhj"�[39m)�[33m,�[39m_angular_common__WEBPACK_IMPORTED_MODULE_10__�[33m=�[39m__webpack_require__(�[32m"SVse"�[39m)�[33m,�[39m_angular_forms__WEBPACK_IMPORTED_MODULE_11__�[33m=�[39m__webpack_require__(�[32m"s7LF"�[39m)�[33m,�[39m_angular_material_form_field__WEBPACK_IMPORTED_MODULE_12__�[33m=�[39m__webpack_require__(�[32m"HsOI"�[39m)�[33m,�

🌍 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?

@clydin
Copy link
Member

clydin commented Sep 12, 2019

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?

@loremaps
Copy link
Author

@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.

@timurso
Copy link

timurso commented Sep 14, 2019

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.

@lazar-vuckovic
Copy link

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.

clydin added a commit to clydin/angular-cli that referenced this issue Sep 15, 2019
…ith terser

There appears to be defects related to terser's ECMA 6 options.  The optimizations present a minima size improvement in general.  Further investigation is required to determine the underlying cause within terser.

Fixes angular#15580
@filipesilva filipesilva added freq1: low Only reported by a handful of users who observe it rarely and removed needs: more info Reporter must clarify the issue labels Sep 19, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Sep 19, 2019
vikerman pushed a commit that referenced this issue Sep 19, 2019
…ith terser

There appears to be defects related to terser's ECMA 6 options.  The optimizations present a minima size improvement in general.  Further investigation is required to determine the underlying cause within terser.

Fixes #15580
vikerman pushed a commit that referenced this issue Sep 19, 2019
…ith terser

There appears to be defects related to terser's ECMA 6 options.  The optimizations present a minima size improvement in general.  Further investigation is required to determine the underlying cause within terser.

Fixes #15580
@wwarby
Copy link

wwarby commented Sep 21, 2019

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.

@clydin
Copy link
Member

clydin commented Sep 21, 2019

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

@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 Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants