title: Updated to CRA 2.0 and now can't build - Out of memory
body: <p>My Yarn build is broken since updating to CRA 2.0.</p>
  
  <p>Getting out of memory error, I've tried running with a bigger max memory and it's not making any difference.</p>
  
  <p>Yarn start is fine, but yarn build gives the following error: </p>
  
  <pre><code>    &lt;--- Last few GCs ---&gt;
  
  [14692:000001A168B8CC30]   367561 ms: Mark-sweep 1245.1 (1430.7) -&gt; 1244.8 (1433.2) MB, 4524.1 / 0.0 ms  allocation failure GC in old space requested
  [14692:000001A168B8CC30]   372188 ms: Mark-sweep 1244.8 (1433.2) -&gt; 1244.8 (1387.7) MB, 4626.6 / 0.0 ms  last resort GC in old space requested
  [14692:000001A168B8CC30]   377070 ms: Mark-sweep 1244.8 (1387.7) -&gt; 1244.8 (1378.2) MB, 4882.6 / 0.0 ms  last resort GC in old space requested
  
  
  &lt;--- JS stacktrace ---&gt;
  
  ==== JS stack trace =========================================
  
  Security context: 00000117FCAA57C1 &lt;JSObject&gt;
      0: builtin exit frame: stringify(this=00000117FCA88FF1 &lt;Object map = 0000015BE0D02BA1&gt;,000002A6D8C022D1 &lt;undefined&gt;,000002A6D8C022D1 &lt;undefined&gt;,00000025F91DAB39 &lt;Object map = 0000016E6AF79681&gt;)
      1: arguments adaptor frame: 1-&gt;3
      2: _send [internal/child_process.js:675] [bytecode=0000024FC7AFB9B1 offset=551](this=0000037EBD602981 &lt;process map = 0000015BE0D0A341&gt;,message=00000025F91D...
  
  FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
   1: node_module_register
   2: v8::internal::FatalProcessOutOfMemory
   3: v8::internal::FatalProcessOutOfMemory
   4: v8::internal::Factory::NewRawTwoByteString
   5: v8::internal::Smi::SmiPrint
   6: v8::internal::StackGuard::HandleInterrupts
   7: v8::internal::wasm::LocalDeclEncoder::Size
   8: v8::internal::wasm::LocalDeclEncoder::Size
   9: v8::internal::wasm::LocalDeclEncoder::Size
  10: v8::internal::wasm::LocalDeclEncoder::Size
  11: v8::internal::wasm::LocalDeclEncoder::Size
  12: v8_inspector::protocol::Debugger::API::SearchMatch::fromJSONString
  13: v8_inspector::protocol::Debugger::API::SearchMatch::fromJSONString
  14: 00000178DC106B21
  </code></pre>
  
  <p>I'm not sure what else has changed to for this to fire.. i.e. what it's trying to stringify that is running out of memory.</p>
  
  <p>Build scripts'</p>
  
  <pre><code> "build": "npm run pre:build &amp;&amp; react-app-rewired build &amp;&amp; npm run post:build",
      "pre:build": "yarn run build:css &amp;&amp; rimraf build &amp;&amp; rimraf mobile/www/app/*",
      "post:build": "cp build/index.html mobile/www/ &amp;&amp; cp build/* mobile/www/app --recursive",
  </code></pre>
  
  <p>Dev dependencies:</p>
  
  <pre><code>  "devDependencies": {
      "@types/react": "16.4.13",
      "babel-core": "^6.26.0",
      "babel-plugin-transform-object-rest-spread": "^6.26.0",
      "babel-preset-es2015": "^6.24.1",
      "babel-preset-react": "^6.24.1",
      "chai": "^4.1.2",
      "cra-build-watch": "^1.0.3",
      "enzyme": "^3.1.0",
      "enzyme-adapter-react-16": "^1.0.1",
      "eslint-plugin-import": "^2.7.0",
      "eslint-plugin-react": "^7.3.0",
      "file-loader": "^1.1.11",
      "gh-pages": "^1.0.0",
      "html-webpack-plugin": "^3.2.0",
      "karma": "^1.7.1",
      "karma-chai": "^0.1.0",
      "karma-chrome-launcher": "^2.2.0",
      "karma-mocha": "^1.3.0",
      "karma-mocha-reporter": "^2.2.5",
      "karma-phantomjs-launcher": "^1.0.4",
      "karma-sourcemap-loader": "^0.3.7",
      "karma-webpack": "^2.0.6",
      "mocha": "^4.0.1",
      "npm-run-all": "^4.1.3",
      "phantomjs-polyfill": "0.0.2",
      "react-addons-test-utils": "^15.6.0",
      "react-test-renderer": "^16.0.0",
      "sinon": "^4.1.2",
      "typescript": "^2.7.2",
      "customize-cra": "^0.1.1"
    },
  </code></pre>