<p dir="auto">With server-side bundles in next@5 the require statements that are built via <code class="notranslate">next build</code> now have an absolute file path.</p>
<p dir="auto">E.g. at the bottom of <code class="notranslate">&lt;projroot&gt;/.next/dist/bundles/pages/_error.js</code> it has <code class="notranslate">module.exports = require("C:\\path\\to\\&lt;projroot&gt;\\node_modules\\next\\dist\\pages\\_error.js");</code> rather than <code class="notranslate">require("next\\dist\\pages\\_error.js");</code>.</p>
<p dir="auto">This means that if I build my site on a continuous integration server and then shift the result onto a deployment server it fails because the file path is wrong.</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">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">After running <code class="notranslate">next build</code> none of the built files should not have absolute file paths.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">After running <code class="notranslate">next build</code> the built files have absolute file paths.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<ol dir="auto">
<li>Run <code class="notranslate">next build</code></li>
<li>Inspect the <code class="notranslate">.next/dist</code> folder</li>
</ol>
<h2 dir="auto">Context</h2>
<p dir="auto">I'd like to follow continuous delivery practices and build my site once on a continuous integration server then use that build across multiple environments (e.g. dev, test, prod) via a deployment pipeline.</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.0.0</td>
</tr>
<tr>
<td>node</td>
<td>6.8.1</td>
</tr>
<tr>
<td>OS</td>
<td>Windows 10</td>
</tr>
</tbody>
</table>
<h1 dir="auto">Bug report</h1>
<p dir="auto">The dynamic routing solution doesn't work at all</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">I have this code using <code class="notranslate">material-ui</code><br>
I have this button</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;Link 
        href='/r/[id]'                  
        as={`/r/${selected.id}`}
        passHref&gt;
            &lt;Button component=&quot;a&quot; variant=&quot;outlined&quot; size=&quot;small&quot;&gt;View Menu&lt;/Button&gt;
&lt;/Link&gt;"><pre class="notranslate"><code class="notranslate">&lt;Link 
        href='/r/[id]'                  
        as={`/r/${selected.id}`}
        passHref&gt;
            &lt;Button component="a" variant="outlined" size="small"&gt;View Menu&lt;/Button&gt;
&lt;/Link&gt;
</code></pre></div>
<p dir="auto">on the other page</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { useRouter } from 'next/router';
const Index = () =&gt; {
  const router = useRouter()
  console.log(router.query.id)
  return (
     )
}"><pre class="notranslate"><code class="notranslate">import { useRouter } from 'next/router';
const Index = () =&gt; {
  const router = useRouter()
  console.log(router.query.id)
  return (
     )
}
</code></pre></div>
<p dir="auto">The <code class="notranslate">next.config.js</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const withOffline = require('next-offline');
const withCSS = require('@zeit/next-css')

const nextConfig = {
  target: 'serverless',
  transformManifest: manifest =&gt; ['/'].concat(manifest),
  workboxOpts: {
    swDest: 'static/service-worker.js',
    runtimeCaching: [
      {
        urlPattern: /^https?.*/,
        handler: 'NetworkFirst',
        options: {
          cacheName: 'https-calls',
          networkTimeoutSeconds: 15,
          expiration: {
            maxEntries: 150,
            maxAgeSeconds: 30 * 24 * 60 * 60, // 1 month
          },
          cacheableResponse: {
            statuses: [0, 200],
          },          
        },
      },
    ],
    maximumFileSizeToCacheInBytes: 5 * 1024 * 1024
  },
};

module.exports = withOffline(withCSS(nextConfig));"><pre class="notranslate"><code class="notranslate">const withOffline = require('next-offline');
const withCSS = require('@zeit/next-css')

const nextConfig = {
  target: 'serverless',
  transformManifest: manifest =&gt; ['/'].concat(manifest),
  workboxOpts: {
    swDest: 'static/service-worker.js',
    runtimeCaching: [
      {
        urlPattern: /^https?.*/,
        handler: 'NetworkFirst',
        options: {
          cacheName: 'https-calls',
          networkTimeoutSeconds: 15,
          expiration: {
            maxEntries: 150,
            maxAgeSeconds: 30 * 24 * 60 * 60, // 1 month
          },
          cacheableResponse: {
            statuses: [0, 200],
          },          
        },
      },
    ],
    maximumFileSizeToCacheInBytes: 5 * 1024 * 1024
  },
};

module.exports = withOffline(withCSS(nextConfig));
</code></pre></div>
<p dir="auto">and the<code class="notranslate"> now.json</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;version&quot;: 2,
  &quot;routes&quot;: [	
    {	
      &quot;src&quot;: &quot;^/service-worker.js$&quot;,	
      &quot;dest&quot;: &quot;/_next/static/service-worker.js&quot;,
      &quot;headers&quot;: {
        &quot;cache-control&quot;: &quot;public, max-age=43200, immutable&quot;,
        &quot;Service-Worker-Allowed&quot;: &quot;/&quot;
      }
    }
  ],
  &quot;builds&quot;: [
    {
      &quot;src&quot;: &quot;next.config.js&quot;,
      &quot;use&quot;: &quot;@now/next&quot;
    }
  ]
}"><pre class="notranslate"><code class="notranslate">{
  "version": 2,
  "routes": [	
    {	
      "src": "^/service-worker.js$",	
      "dest": "/_next/static/service-worker.js",
      "headers": {
        "cache-control": "public, max-age=43200, immutable",
        "Service-Worker-Allowed": "/"
      }
    }
  ],
  "builds": [
    {
      "src": "next.config.js",
      "use": "@now/next"
    }
  ]
}
</code></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Expect to move to a new route but nothing happens</p>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>OS: Windows</li>
<li>Browser : chrome</li>
<li>Version of Next.js: [e.g. 9.0.6]</li>
</ul>