title: yarn install and build consumes 100% CPU and memory 95%
body: <p>I am working on Electron, Angular 8, Nodejs based project. Whenever I use the following command, my system consumes 100% CPU utilization and 95% memory, and the system freezes for 5 to 7 minutes. I am using yarn instead of npm as suggested by our UI architects.</p>
  <p>I use the following command.</p>
  <pre><code>yarn install &amp;&amp; yarn build
  </code></pre>
  <p>I am using Windows 10 with 16 GB RAM. It is a common problem for other team members also.
  As per <code>package.json</code>, the command for yarn build is</p>
  <pre><code>&quot;build&quot;: &quot;rimraf dist &amp;&amp; webpack --config config/webpack.dev.js&quot;,
  </code></pre>
  <p>I provide below the code for <code>webpack.dev.js</code></p>
  <pre><code>const webpackMerge = require('webpack-merge');
  const commonConfig = require('./webpack.common.js');
  
  module.exports = webpackMerge(commonConfig, {
      mode: 'development',
      devtool: 'inline-source-map',
  });
  </code></pre>
  <p>Currently, the size of <code>node_modules</code> directory is 1.5 GB.
  I want to know whether it is the expected behavior in case NodeJS or yarn-based project? I have very large applications in java but when I build using Maven or Gradle, I do not see this kind of behavior.
  Please suggest me whether it can be improved.</p>
  <p>I have also gone through the following StackOverflow link and could not get a proper answer.
  <a href="https://stackoverflow.com/questions/49961323/yarn-install-consumes-all-memory-on-teamcity-and-jenkins">yarn install consumes all memory on TeamCity and Jenkins</a></p>