<p dir="auto">Hi, next is great, thnx.</p>
<p dir="auto">I have a big project based on lerna monorepo with next, and custom next server as a different packages. For production build we use few stages docker build, lerna build building all packets in monorepo, after this i wanna take custom server package and builded .next folder for the run next on server, but for the disk space economy, i wanna include using in next node_modules to next server bundle. I try customize webpack config for chose config.externals, or <a class="issue-link js-issue-link notranslate" rel="noopener noreferrer nofollow" href="https://linear.app/vercel/issue/NEXT-plugin-transpile-node-modules">next-plugin-transpile-node-modules</a>, but i dont have a luck.</p>
<p dir="auto">Maybee you have example proj, example config, actual plugin or any advice for this?</p>
<p dir="auto">Thnx.</p>
<p dir="auto">Next version 7.0.1</p>
<p dir="auto"><a href="https://spectrum.chat/thread/2a07bd86-895c-41f9-a610-392765a845df" rel="nofollow">https://spectrum.chat/thread/2a07bd86-895c-41f9-a610-392765a845df</a></p>
<p dir="auto">I'm trying to upgrade from v5 to v6. And I encountered a build error which caused from the <code class="notranslate">_document.js</code> as the following screenshot. Once I remove the <code class="notranslate">_document.js</code> the error was gone. In additional even that I used the <a href="https://github.com/zeit/next.js#custom-document">example</a> the error still occurs.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/21308003/39695649-ec3203e8-521d-11e8-8383-1700a387a2ec.png"><img width="997" alt="2018-05-07 5 37 10" src="https://user-images.githubusercontent.com/21308003/39695649-ec3203e8-521d-11e8-8383-1700a387a2ec.png" style="max-width: 100%;"></a></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>
<ul dir="auto">
<li>Upgraded to v6 and build success with <code class="notranslate">_document.js</code>.</li>
</ul>
<h2 dir="auto">Current Behavior</h2>
<ul dir="auto">
<li>Upgraded to v6 but build failed with <code class="notranslate">_document.js</code>.</li>
</ul>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<ol dir="auto">
<li>Upgraded to v6 via <a href="https://github.com/zeit/next.js/issues/4239#issuecomment-385691474" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/4239/hovercard">this</a> instruction.</li>
<li>Run <code class="notranslate">yarn dev</code> and build success.</li>
<li>But build failed due to <code class="notranslate">Module build failed: ReferenceError: Unknown helper getPrototypeOf</code> which caused from <code class="notranslate">_document.js</code>.</li>
</ol>
<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>v6</td>
</tr>
<tr>
<td>node</td>
<td>v9.11.1</td>
</tr>
<tr>
<td>OS</td>
<td>MacOS</td>
</tr>
<tr>
<td>browser</td>
<td>Google Chrome</td>
</tr>
</tbody>
</table>