Updating to newer versions

So i’m updating my companies old app to use new versions of… well everything. It required a few changes, mainly adding “/ngx” to a bunch of imports. But now it compiles normally. However then I tried --prod and then it breaks. I get this error:

<--- Last few GCs --->

[20080:0x55a22ec63b40]    37993 ms: Mark-sweep 1383.1 (1424.8) -> 1382.6 (1423.8) MB, 469.2 / 0.0 ms  (average mu = 0.101, current mu = 0.048) allocation failure scavenge might not succeed
[20080:0x55a22ec63b40]    37999 ms: Scavenge 1383.3 (1423.8) -> 1382.8 (1424.3) MB, 4.0 / 0.0 ms  (average mu = 0.101, current mu = 0.048) allocation failure 
[20080:0x55a22ec63b40]    38005 ms: Scavenge 1383.6 (1424.3) -> 1383.0 (1425.3) MB, 4.0 / 0.0 ms  (average mu = 0.101, current mu = 0.048) allocation failure 


<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0xda3285cfc5d]
Security context: 0x2dc27a01d971 <JSObject>
    1: isJSDocOptionalParameter(aka isJSDocOptionalParameter) [0x1d546ab1dd91] [/home/jan/Development/appki/tmppet/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:~29448] [pc=0xda329968927](this=0x3adfdef825b1 <undefined>,0x36adde5d8451 <NodeObject map = 0x8998e2bf61>)
    2: isOptionalParameter(aka isOptionalParameter) ...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: report.20190226.145711.20080.001.json
Node.js report completed
 1: 0x55a22cb1e6f1 node::Abort() [node]
 2: 0x55a22cb1ffb7 node::OnFatalError(char const*, char const*) [node]
 3: 0x55a22ccb6492 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0x55a22ccb66eb v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0x55a22d04e573  [node]
 6: 0x55a22d04e6b4  [node]
 7: 0x55a22d05e266 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
 8: 0x55a22d05ec0e v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0x55a22d060e0d v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
10: 0x55a22d060e62 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
11: 0x55a22d02f7a5 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
12: 0x55a22d29e20f v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
13: 0xda3285cfc5d 
[ERROR] Signal exit from subprocess.

What have I done wrong?