<p dir="auto">It is my first application with Next.js and I am facing problems to deploy the project to Heroku.<br>
I am using Express server and a external .babelrc file.</p>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">No errors building/running project in Heroku.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">I am running <code class="notranslate">yarn build</code> and then <code class="notranslate">git init / add / commit / push</code> in <code class="notranslate">.next/dist</code> folder and copying <code class="notranslate">package.json</code> into it too.</p>
<h2 dir="auto">Context</h2>
<p dir="auto">This is my scripts from <code class="notranslate">package.json</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;scripts&quot;: {
    &quot;start&quot;: &quot;NODE_ENV=production node server/server.js&quot;,
    &quot;dev&quot;: &quot;nodemon -w server server/server.js --exec babel-node&quot;,
    &quot;build&quot;: &quot;next build &amp;&amp; babel server -d .next/dist/server&quot;,
    &quot;lint&quot;: &quot;eslint --fix components lib pages server **/*.js&quot;,
    &quot;snyk&quot;: &quot;snyk test&quot;,
    &quot;heroku-postbuild&quot;: &quot;next build &amp;&amp; babel server -d .next/dist/server&quot;
  }"><pre class="notranslate"><code class="notranslate">"scripts": {
    "start": "NODE_ENV=production node server/server.js",
    "dev": "nodemon -w server server/server.js --exec babel-node",
    "build": "next build &amp;&amp; babel server -d .next/dist/server",
    "lint": "eslint --fix components lib pages server **/*.js",
    "snyk": "snyk test",
    "heroku-postbuild": "next build &amp;&amp; babel server -d .next/dist/server"
  }
</code></pre></div>
<p dir="auto"><code class="notranslate">next.config.js</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="module.exports = {
  webpack: (config, { dev }) =&gt; {
    // For the development version, we'll use React.
    // Because, it support react hot loading and so on.
    if (dev) {
      return config;
    }

    config.resolve.alias = {
      react: 'inferno-compat',
      'react-dom': 'inferno-compat'
    };
    return config;
  }
};"><pre class="notranslate"><code class="notranslate">module.exports = {
  webpack: (config, { dev }) =&gt; {
    // For the development version, we'll use React.
    // Because, it support react hot loading and so on.
    if (dev) {
      return config;
    }

    config.resolve.alias = {
      react: 'inferno-compat',
      'react-dom': 'inferno-compat'
    };
    return config;
  }
};
</code></pre></div>
<p dir="auto">And the <code class="notranslate">.babelrc</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [
    [
      &quot;next/babel&quot;,
      {
        &quot;preset-env&quot;: {
          &quot;modules&quot;: &quot;commonjs&quot;
        }
      }
    ]
  ],
  &quot;env&quot;: {
    &quot;development&quot;: {
      &quot;plugins&quot;: [&quot;inline-dotenv&quot;]
    },
    &quot;production&quot;: {
      &quot;plugins&quot;: [&quot;transform-inline-environment-variables&quot;]
    }
  }
}
"><pre class="notranslate"><code class="notranslate">{
  "presets": [
    [
      "next/babel",
      {
        "preset-env": {
          "modules": "commonjs"
        }
      }
    ]
  ],
  "env": {
    "development": {
      "plugins": ["inline-dotenv"]
    },
    "production": {
      "plugins": ["transform-inline-environment-variables"]
    }
  }
}

</code></pre></div>
<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>6.0.1</td>
</tr>
<tr>
<td>node</td>
<td>9.5.0</td>
</tr>
<tr>
<td>@babe/*</td>
<td>^7</td>
</tr>
</tbody>
</table>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">The expected behavior is that of the online demo.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">Unfortunately, when you clone the repo, npm install and run it gives an error when you navigate client-side to the Home:<br>
<em>TypeError: Cannot read property 'data' of undefined at new WithData (<a href="http://localhost:3000/_next/1509705233244/page/:19478:79" rel="nofollow">http://localhost:3000/_next/1509705233244/page/:19478:79</a>)</em></p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<p dir="auto">The steps of the example installation guide:</p>
<ol dir="auto">
<li>curl <a href="https://codeload.github.com/zeit/next.js/tar.gz/master">https://codeload.github.com/zeit/next.js/tar.gz/master</a> | tar -xz --strip=2 next.js-master/examples/with-apollo</li>
<li>cd with-apollo</li>
<li>npm install</li>
<li>npm run dev</li>
<li>navigate from home to /about</li>
<li>Navigate back to Home</li>
</ol>
<h2 dir="auto">Context</h2>
<p dir="auto">I tried to clone the repo because I found the issue on my project after upgrading to React Apollo 2 and copying the /lib code of the example (initApollo and withData).</p>
<p dir="auto">On my project I see another issue: I see always the client-side network call even on refresh. I fear that it has to do with some confusion with Apollo 2 InMemoryCache, sometimes found imported from apollo-cache-inmemory and sometimes from apollo-client-preset.</p>
<p dir="auto">Thank you,<br>
Matteo</p>