<h1 dir="auto">Bug report</h1>
<h2 dir="auto">Describe the bug</h2>
<p dir="auto">So there is a <code class="notranslate">./pages/_document.js</code> and <code class="notranslate">&lt;NextScript /&gt;</code>, even if you remove it next.js will include all the bundles. I'm curious why <code class="notranslate">&lt;NextScript /&gt;</code> seems to not matter. Nothing changes if I remove it or add it back.</p>
<h2 dir="auto">To Reproduce</h2>
<p dir="auto">Steps to reproduce the behavior, please provide code snippets or a repository:</p>
<ol dir="auto">
<li>Go to <a href="https://with-nextscript-llzwhvgbup.now.sh" rel="nofollow">https://with-nextscript-llzwhvgbup.now.sh</a> (it is <a href="https://github.com/zeit/next.js/tree/canary/examples/with-emotion">with-emotion example</a> deployed as is)</li>
<li>Check Network tab in dev tools</li>
<li>Scripts are being dowloaded</li>
<li>Go to <a href="https://without-nextscript-vmfhuqxgbt.now.sh" rel="nofollow">https://without-nextscript-vmfhuqxgbt.now.sh</a> (it is <a href="https://github.com/zeit/next.js/tree/canary/examples/with-emotion">with-emotion example</a> with removed <code class="notranslate">&lt;NextScript /&gt;</code> and deployed)</li>
<li>Check Network tab in dev tools</li>
<li>Scripts are <strong>still</strong> being dowloaded</li>
</ol>
<p dir="auto">build process is <code class="notranslate">next build &amp;&amp; next export</code></p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">No scripts should be in place</p>
<h2 dir="auto">Screenshots</h2>
<p dir="auto">N/A</p>
<h2 dir="auto">System information</h2>
<ul dir="auto">
<li>OS: macOS 10.13.4</li>
<li>Browser N/A</li>
<li>Version of Next.js: latest</li>
</ul>
<h2 dir="auto">Additional context</h2>
<p dir="auto">kinda related <a href="https://spectrum.chat/thread/3f923307-a694-4af5-b000-517a7e26c0d7" rel="nofollow">https://spectrum.chat/thread/3f923307-a694-4af5-b000-517a7e26c0d7</a><br>
I tried to achieve approach described in this tweet <a href="https://twitter.com/_davideast/status/1009112973439393795" rel="nofollow">https://twitter.com/_davideast/status/1009112973439393795</a></p>
<h1 dir="auto">Feature request</h1>
<h2 dir="auto">Is your feature request related to a problem? Please describe.</h2>
<p dir="auto">We want some static pages to be as lightweight as possible and we're fine with full page reloads navigating out of them if we can chop off extra 200Kb.</p>
<h2 dir="auto">Describe the solution you'd like</h2>
<p dir="auto">Add an option to path map in next.config.js to indicate this specific page doesn't need to include react app and can operate as plain HTML page.<br>
React app is only removed in case the flag is set to <code class="notranslate">true</code> explicitly.</p>
<p dir="auto">Looks like it should be enough to just make <code class="notranslate">files</code> content  empty there if option is set. <a href="https://github.com/zeit/next.js/blob/canary/server/render.js#L100">https://github.com/zeit/next.js/blob/canary/server/render.js#L100</a></p>
<p dir="auto">For the simple example from tutorial setting up</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// next.config.js
module.exports = {
  exportPathMap: function(defaultPathMap) {
    return {
      '/': { page: '/', withoutReact: true },
      '/about': { page: '/about' }
    }
  }
}"><pre class="notranslate"><span class="pl-c">// next.config.js</span>
<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-en">exportPathMap</span>: <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">defaultPathMap</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">{</span>
      <span class="pl-s">'/'</span>: <span class="pl-kos">{</span> <span class="pl-c1">page</span>: <span class="pl-s">'/'</span><span class="pl-kos">,</span> <span class="pl-c1">withoutReact</span>: <span class="pl-c1">true</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-s">'/about'</span>: <span class="pl-kos">{</span> <span class="pl-c1">page</span>: <span class="pl-s">'/about'</span> <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">As a result <code class="notranslate">/out</code> would be populated with</p>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;!--/out/index/index.html--&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charSet=&quot;utf-8&quot; class=&quot;next-head&quot;/&gt;
  &lt;/head&gt;
&lt;body&gt;
   &lt;a href=&quot;/about&quot;&gt;About&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;


&lt;!--/out/about/index.html--&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charSet=&quot;utf-8&quot; class=&quot;next-head&quot;/&gt;
    &lt;link rel=&quot;preload&quot; href=&quot;/_next/9d298d49-6fb5-4c6f-a992-31fdb0d3e01a/page/about.js&quot; as=&quot;script&quot;/&gt;
    &lt;!--other scripts--&gt;
  &lt;/head&gt;
&lt;body&gt;
   &lt;!--page content --&gt;
   &lt;script&gt;
     NEXT_DATA = {&quot;props&quot;: &quot;etc..&quot;}
   &lt;/script&gt;
  &lt;script id=&quot;__NEXT_PAGE__/about&quot; src=&quot;...&quot;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;"><pre class="notranslate"><span class="pl-c">&lt;!--/out/index/index.html--&gt;</span>
<span class="pl-c1">&lt;!DOCTYPE html<span class="pl-kos">&gt;</span></span>
<span class="pl-kos">&lt;</span><span class="pl-ent">html</span><span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
    <span class="pl-kos">&lt;</span><span class="pl-ent">meta</span> <span class="pl-c1">charSet</span>="<span class="pl-s">utf-8</span>" <span class="pl-c1">class</span>="<span class="pl-s">next-head</span>"/&gt;
  <span class="pl-kos">&lt;/</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
   <span class="pl-kos">&lt;</span><span class="pl-ent">a</span> <span class="pl-c1">href</span>="<span class="pl-s">/about</span>"<span class="pl-kos">&gt;</span>About<span class="pl-kos">&lt;/</span><span class="pl-ent">a</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">html</span><span class="pl-kos">&gt;</span>


<span class="pl-c">&lt;!--/out/about/index.html--&gt;</span>
<span class="pl-c1">&lt;!DOCTYPE html<span class="pl-kos">&gt;</span></span>
<span class="pl-kos">&lt;</span><span class="pl-ent">html</span><span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
    <span class="pl-kos">&lt;</span><span class="pl-ent">meta</span> <span class="pl-c1">charSet</span>="<span class="pl-s">utf-8</span>" <span class="pl-c1">class</span>="<span class="pl-s">next-head</span>"/&gt;
    <span class="pl-kos">&lt;</span><span class="pl-ent">link</span> <span class="pl-c1">rel</span>="<span class="pl-s">preload</span>" <span class="pl-c1">href</span>="<span class="pl-s">/_next/9d298d49-6fb5-4c6f-a992-31fdb0d3e01a/page/about.js</span>" <span class="pl-c1">as</span>="<span class="pl-s">script</span>"/&gt;
    <span class="pl-c">&lt;!--other scripts--&gt;</span>
  <span class="pl-kos">&lt;/</span><span class="pl-ent">head</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
   <span class="pl-c">&lt;!--page content --&gt;</span>
   <span class="pl-kos">&lt;</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
     <span class="pl-c1">NEXT_DATA</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-s">"props"</span>: <span class="pl-s">"etc.."</span><span class="pl-kos">}</span>
   <span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">id</span>="<span class="pl-s">__NEXT_PAGE__/about</span>" <span class="pl-c1">src</span>="<span class="pl-s">...</span>"<span class="pl-kos">&gt;</span><span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">body</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">html</span><span class="pl-kos">&gt;</span></pre></div>
<p dir="auto">This way index page is going to be very lightweight, with a tradeoff of full page reload navigating to /about. While /about would load the app, so navigation back to / would be handled on the client-side.</p>
<h2 dir="auto">Describe alternatives you've considered</h2>
<p dir="auto">Static site generators :) But we need way more than just static pages and next.js fits us best except for this tiny quirk.</p>
<h2 dir="auto">Additional context</h2>
<p dir="auto">Happy to implement that, just wanted to make sure this is not something going against the roadmap for next.js. Or if it's something already available, but hidden. I'm new to the library, only playing around for the second day.</p>