Skip to content

ng build --prod crashes after upgrade to v7 #12733

Closed
@maxime1992

Description

@maxime1992

Bug Report or Feature Request (mark with an x)

- [ x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

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

Versions

Angular CLI: 7.0.2
Node: 10.0.0
OS: linux x64
Angular: 7.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.10.2
@angular-devkit/build-angular      0.10.2
@angular-devkit/build-ng-packagr   0.10.2
@angular-devkit/build-optimizer    0.10.2
@angular-devkit/build-webpack      0.10.2
@angular-devkit/core               7.0.2
@angular-devkit/schematics         7.0.2
@angular/cli                       7.0.2
@angular/flex-layout               7.0.0-beta.19
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.0.2
@schematics/angular                7.0.2
@schematics/update                 0.10.2
ng-packagr                         4.4.0
rxjs                               6.3.3
typescript                         3.1.3
webpack                            4.19.1

Issue

Upgrading to the latest version (7) I am not able to build my project locally (Linux, ubuntu 64bits, 32gb RAM) nor... on CI 😿

The log given by the failure

yarn run build:browser
yarn run v1.6.0
(node:142) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ ng build frontend --prod --source-map false

<--- Last few GCs --->

[163:0x3dd8270]   617339 ms: Mark-sweep 1332.2 (1447.7) -> 1332.2 (1447.7) MB, 1465.5 / 0.0 ms  allocation failure GC in old space requested
[163:0x3dd8270]   618828 ms: Mark-sweep 1332.2 (1447.7) -> 1332.2 (1431.7) MB, 1488.5 / 0.0 ms  last resort GC in old space requested
[163:0x3dd8270]   620307 ms: Mark-sweep 1332.2 (1431.7) -> 1332.2 (1431.7) MB, 1478.9 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x30481308427d]
    1: StubFrame [pc: 0x3048130e8700]
Security context: 0x11ddf7a206a9 <JSObject>
    2: add_parameter [/builds/maxime1992/frontend/node_modules/terser/dist/bundle.js:2277] [bytecode=0xefb01b49349 offset=16](this=0x37561530ddc9 <Object map = 0x252dd083ea21>,token=0x37561530dfd1 <AST_Token map = 0x252dd083f061>)
    3: binding_element(aka binding_element) [/builds/maxime1992/frontend/node_modules/terse...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [ng build frontend --prod --source-map false]
 2: 0x87b56c [ng build frontend --prod --source-map false]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [ng build frontend --prod --source-map false]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [ng build frontend --prod --source-map false]
 5: v8::internal::Factory::NewInternalizedStringImpl(v8::internal::Handle<v8::internal::String>, int, unsigned int) [ng build frontend --prod --source-map false]
 6: v8::internal::InternalizedStringKey::AsHandle(v8::internal::Isolate*) [ng build frontend --prod --source-map false]
 7: v8::internal::StringTable::LookupKey(v8::internal::Isolate*, v8::internal::StringTableKey*) [ng build frontend --prod --source-map false]
 8: v8::internal::StringTable::LookupString(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>) [ng build frontend --prod --source-map false]
 9: 0x10ce5cb [ng build frontend --prod --source-map false]
10: v8::internal::Runtime_KeyedGetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [ng build frontend --prod --source-map false]
11: 0x30481308427d
Aborted (core dumped)
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: Job failed: exit code 1

Mention any other details that might be useful

Seems that the culprit might be Terser... Eventually that might be related to #12646 but I'm not sure

Also, the compilation is fine without the --prod

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