title: NodeJs :- 92% chunk asset optimization TerserPlugin FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
body: <p>I've following dependencies and huge set of components in react and using storybook and webpack,</p>
  
  <pre><code>"@storybook/react": "5.0.6",
  "styled-components": "5.0.1",
  "typescript": "3.5",
  "webpack": "4.39.3",
  "webpack-cli": "3.3.7"
  </code></pre>
  
  <p>locally everything was working fine while building storybook at remote it was continuously failing at this step, giving this error :-</p>
  
  <pre><code>16:19:16 &lt;s&gt; [webpack.Progress] 92% chunk asset optimization TerserPlugin
  16:21:20 
  16:21:20 &lt;--- Last few GCs ---&gt;
  16:21:20 
  16:21:20 [430:0x3f22bb0]   291204 ms: Mark-sweep 1403.2 (1484.9) -&gt; 1403.2 (1484.9) MB, 1152.6 / 0.0 ms  allocation failure GC in old space requested
  16:21:20 [430:0x3f22bb0]   292437 ms: Mark-sweep 1403.2 (1484.9) -&gt; 1403.0 (1453.9) MB, 1233.4 / 0.0 ms  last resort GC in old space requested
  16:21:20 [430:0x3f22bb0]   293968 ms: Mark-sweep 1403.0 (1453.9) -&gt; 1403.0 (1453.9) MB, 1531.0 / 0.0 ms  last resort GC in old space requested
  16:21:20 
  16:21:20 
  16:21:20 &lt;--- JS stacktrace ---&gt;
  16:21:20 
  16:21:20 ==== JS stack trace =========================================
  16:21:20 
  16:21:20 Security context: 0x3e34ae9a5879 &lt;JSObject&gt;
  16:21:20     1: /* anonymous */ [/home/jenkins/workspace/FlashtoolsUikit-03-Npm-Package-Update-Storybook/node_modules/webpack/node_modules/source-map/lib/source-node.js:~342] [pc=0x18aaeba69706](this=0xc21c728c209 &lt;JSGlobal Object&gt;,chunk=0x19b226eb79a1 &lt;String[2]:  }&gt;,original=0x1f48ac1ce9 &lt;Object map = 0x3723b1482259&gt;)
  16:21:20     2: SourceNode_walk [/home/jenkins/workspace/FlashtoolsUikit-03-Npm-Package-Update...
  16:21:20 
  16:21:20 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
  16:21:20  1: node::Abort() [node]
  16:21:20  2: 0x8c21ec [node]
  16:21:20  3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
  16:21:20  4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
  16:21:20  5: v8::internal::Factory::NewUninitializedFixedArray(int) [node]
  16:21:20  6: 0xd4b153 [node]
  16:21:20  7: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [node]
  16:21:20  8: 0x18aaeb5042fd
  16:21:48 sh: line 1:   420 Aborted                 (core dumped) npm run build:storybook
  16:21:48 npm ERR! code ELIFECYCLE
  16:21:48 npm ERR! errno 134
  </code></pre>
  
  <p>tried updating webpack (terser plugin specially) after google search but no luck, keep on getting this error continuously.</p>