<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR in ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/renderToStringWithData.js
Module not found: Error: Can't resolve 'react-dom/server' in '/Users/Vaughan/dev-live/vwp/node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo'
 @ ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/renderToStringWithData.js 3:15-42
 @ ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/index.js
 @ ./packages/next-apollo/withData.js
 @ ./pages/map.js
 @ multi ./pages/map.js"><pre class="notranslate"><code class="notranslate">ERROR in ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/renderToStringWithData.js
Module not found: Error: Can't resolve 'react-dom/server' in '/Users/Vaughan/dev-live/vwp/node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo'
 @ ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/renderToStringWithData.js 3:15-42
 @ ./node_modules/.registry.npmjs.org/react-apollo/2.1.0-beta.0/node_modules/react-apollo/index.js
 @ ./packages/next-apollo/withData.js
 @ ./pages/map.js
 @ multi ./pages/map.js
</code></pre></div>
<p dir="auto">See <a href="https://github.com/zeit/next.js/blob/f9b52cfcb6cba5f2af93caf3cc8bc3636571323f/server/build/webpack.js#L155">https://github.com/zeit/next.js/blob/f9b52cfcb6cba5f2af93caf3cc8bc3636571323f/server/build/webpack.js#L155</a></p>
<p dir="auto">This aliasing seems to prevent require sub-paths.</p>
<p dir="auto">PS. I am using <code class="notranslate">pnpm</code>. <em>Maybe</em> this could be related...</p>
<p dir="auto"><strong>Workaround</strong></p>
<p dir="auto">Add this to your <code class="notranslate">next.config.js</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="delete config.resolve.alias['react-dom']"><pre class="notranslate"><code class="notranslate">delete config.resolve.alias['react-dom']
</code></pre></div>



<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">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5</td>
</tr>
<tr>
<td>node</td>
<td>8</td>
</tr>
<tr>
<td>OS</td>
<td>macOS</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome</td>
</tr>
<tr>
<td>etc</td>
<td></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?q=is%3Aissue">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<p dir="auto">This is an issue for v5, I didn't test v6 yet, but I believe from some other ticket that it is still happening (e.g. requiring call to <code class="notranslate">app.prepare()</code>)</p>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">When shipping an app bundled for production, we shouldn't require development/build dependencies with the whole app.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">Right now this is required because the server always tries to load <code class="notranslate">next.config.js</code> in production mode and the config decorator approach (<code class="notranslate">withSourceMaps = require('@zeit/next-source-maps')</code>) makes it inconvenient to exclude webpack plugins from production bundle.</p>
<h2 dir="auto">Context</h2>
<p dir="auto">Having small bundles helps save server and storage space - and is a requirement to run on serverless environment.</p>
<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>5</td>
</tr>
<tr>
<td>node</td>
<td>8</td>
</tr>
<tr>
<td>OS</td>
<td>docker (ubuntu), serverless</td>
</tr>
</tbody>
</table>