title: Node JS crashes when gatsby builds the images
body: <p>When I run gatsby develop it works fine, but when I run <code>gatsby build</code> node js crashes with this error:</p>
  
  <pre><code>    [==                          ]   46.026 s 69/896 8% Generating image thumbnails
  
  &lt;--- Last few GCs ---&gt;
  
  [38861:0x102802000]    75001 ms: Scavenge 1286.0 (1422.9) -&gt; 1285.5 (1423.4) MB, 4.1 / 0.0 ms  (average mu = 0.087, current mu = 0.045) allocation failure 
  [38861:0x102802000]    75007 ms: Scavenge 1286.2 (1423.4) -&gt; 1285.8 (1423.9) MB, 4.0 / 0.0 ms  (average mu = 0.087, current mu = 0.045) allocation failure 
  [38861:0x102802000]    75012 ms: Scavenge 1286.5 (1423.9) -&gt; 1286.0 (1424.4) MB, 4.0 / 0.0 ms  (average mu = 0.087, current mu = 0.045) allocation failure 
  
  
  &lt;--- JS stacktrace ---&gt;
  
  ==== JS stack trace =========================================
  
      0: ExitFrame [pc: 0x222bc6edbe3d]
      1: StubFrame [pc: 0x222bc6edd3c6]
  Security context: 0x39162a79e6e9 &lt;JSObject&gt;
      2: SourceMapGenerator_serializeMappings [0x3916d3cfa859] [/Library/WebServer/Documents/website.com/node_modules/source-map/lib/source-map-generator.js:~303] [pc=0x222bc7ff6c5c](this=0x3916dcf82
  201 &lt;SourceMapGenerator map = 0x39164e1fdda9&gt;)
      3: SourceMapGenerator_toJSON [0x3916d3cfa8d9] [/Library/WebServer/...
  
  FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
   1: 0x10003cf99 node::Abort() [/usr/local/bin/node]
   2: 0x10003d1a3 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
   3: 0x1001b7835 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
   4: 0x100585682 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
   5: 0x100588155 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
   6: 0x100583fff v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
   7: 0x1005821d4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
   8: 0x10058ea6c v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
   9: 0x10058eaef v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
  10: 0x10055e434 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
  11: 0x1007e6714 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
  12: 0x222bc6edbe3d 
  13: 0x222bc6edd3c6 
  Abort trap: 6
  </code></pre>
  
  <p>I had a lot of images from wordpress, they were in the post so what I did I moved the uploads folder to static/img/uploads like this all the images in the posts are working fine, but now I cannot build and it crashes, also on netlify.</p>
  
  <p>This is what I have in the <code>gatsby-config.js</code> </p>
  
  <pre><code>{
        // keep as first gatsby-source-filesystem plugin for gatsby image support
        resolve: 'gatsby-source-filesystem',
        options: {
          path: `${__dirname}/static/img`,
          name: 'uploads'
        }
      },
  </code></pre>
  
  <p>and this </p>
  
  <pre><code>{
        resolve: 'gatsby-transformer-remark',
        options: {
          plugins: [
            {
              resolve: 'gatsby-remark-relative-images',
              options: {
                name: 'uploads'
              }
            },
            {
              resolve: 'gatsby-remark-images',
              options: {
                // It's important to specify the maxWidth (in pixels) of
                // the content container as this plugin uses this as the
                // base for generating different widths of each image.
                maxWidth: 700,
                linkImagesToOriginal: false
              }
            },
            `gatsby-remark-images-medium-zoom`,
            {
              resolve: 'gatsby-remark-copy-linked-files',
              options: {
                destinationDir: 'static'
              }
            }
          ]
        }
      },
  </code></pre>
  
  <p>Before it was working, I then cleaned the folder to remove unused images but now I cannot build anymore ... Is there a better way to import the images from wordpress? (I don't want to source from wp since I just want to use Gatsby and remove all the wp files)</p>
  
  <p>Thanks</p>