<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">I need to bump up the default 100KB <a href="https://github.com/expressjs/body-parser/blob/master/lib/types/raw.js">bodyParser raw.js limit</a> but I can't seem to figure out the right way in Next.js 5.1.0<br>
I tried adding it to index.js but with no effect:<br>
<code class="notranslate">expressApp.use(bodyParser.raw({ limit: '5mb' }));</code></p>
<p dir="auto">I also modified the <a href="https://github.com/expressjs/body-parser/blob/master/lib/types/raw.js">raw.js</a> vendor file to make sure it would work if the value was increased.</p>
<p dir="auto">Long story short, how would I go about modifying the raw body-parser limit?<br>
<code class="notranslate">   PayloadTooLargeError: request entity too large at readStream (/Users/xxx/node_modules/raw-body/index.js:155:17) at getRawBody (/Users/xxx/node_modules/raw-body/index.js:108:12) at read (/Users/xxx/node_modules/body-parser/lib/read.js:77:3) at jsonParser (/Users/xxx/node_modules/body-parser/lib/types/json.js:134:5) at Layer.handle [as handle_request] (/Users/xxx/node_modules/express/lib/router/layer.js:95:5)</code></p>
<p dir="auto">The build process does not recognise shared files when your pages export an imported or wrapped component.</p>
<p dir="auto">A common way of batching multiple <code class="notranslate">getInitialProps</code> is to wrap your pages in multiple HOC's - however doing this causes these issues described here.</p>
<p dir="auto">I'll try to explain using <code class="notranslate">moment</code> as an example dependency.</p>
<p dir="auto">These three files are identical.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pages/one/index.js
pages/two/index.js
pages/three/index.js"><pre class="notranslate"><code class="notranslate">pages/one/index.js
pages/two/index.js
pages/three/index.js
</code></pre></div>
<h4 dir="auto">Broken Page Structure</h4>
<p dir="auto">Doesn't bundle correctly, <code class="notranslate">one.js</code>, <code class="notranslate">two.js</code> and <code class="notranslate">three.js</code> include the <code class="notranslate">moment</code> code.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import View from './View';
import moment from 'moment';

export default View;"><pre class="notranslate"><code class="notranslate">import View from './View';
import moment from 'moment';

export default View;
</code></pre></div>
<h4 dir="auto">Working Page Structure</h4>
<p dir="auto">Bundles correctly, <code class="notranslate">app.js</code> includes the <code class="notranslate">moment</code> code</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import moment from 'moment';

export default () =&gt; &quot;page one&quot;"><pre class="notranslate"><code class="notranslate">import moment from 'moment';

export default () =&gt; "page one"
</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">Expected Behavior</h2>


<p dir="auto">The app.js file to include all shared files between pages regardless of how the page is exported.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto">Each page is bundled with the same files causing duplicate code to be downloaded across pages.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Clone <a href="https://github.com/stevebluck/next-test">https://github.com/stevebluck/next-test</a></li>
<li><code class="notranslate">yarn install</code></li>
<li><code class="notranslate">yarn build</code></li>
<li><code class="notranslate">yarn start-broken</code></li>
<li>Open a new terminal tab and run <code class="notranslate">yarn start-working</code></li>
<li>Open 2 browser tabs at <code class="notranslate">http://localhost:3000/one</code> and <code class="notranslate">http://localhost:4000/one</code></li>
<li>Compare the bundles, port 4000 is the working version</li>
</ol>
<h2 dir="auto">Context</h2>


<p dir="auto">Bundles are too large</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>canary</td>
</tr>
<tr>
<td>node</td>
<td>8.9.0</td>
</tr>
<tr>
<td>OS</td>
<td>MacOS high Sierra 10.13.3</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome/any</td>
</tr>
</tbody>
</table>