<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"><code class="notranslate">next export</code> should support static files like <code class="notranslate">robots.txt</code>.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto"><code class="notranslate">next export</code> does not apparently support static files like <code class="notranslate">robots.txt</code>. Or if it does, it's a well hidden feature.</p>
<h2 dir="auto">Context</h2>


<p dir="auto">I'd like to use next.js for creating a static site (built using <code class="notranslate">next export</code>, with no custom server for routing). This static site needs the usual static URLs, such as <code class="notranslate">/robots.txt</code>.</p>
<p dir="auto">I can't add a custom server.</p>
<p dir="auto">How do I implement <code class="notranslate">robots.txt</code> with <code class="notranslate">next export</code>?</p>
<ul dir="auto">
<li>I can't use a custom <code class="notranslate">server.js</code> to redirect <code class="notranslate">/robots.txt</code> to <code class="notranslate">/static/robots.txt</code>, because <code class="notranslate">next export</code> doesn't use <code class="notranslate">server.js</code>.</li>
<li>I can't specify <code class="notranslate">{ '/robots.txt': { page: '/static/robots.txt' }}</code> in the <code class="notranslate">next.config.js</code> function <code class="notranslate">exportPathMap</code> used by <code class="notranslate">next export</code>, because this mapping applies only to pages inside the <code class="notranslate">pages</code> directory.</li>
<li>I can't create a <code class="notranslate">pages/robots.txt.js</code> that uses <code class="notranslate">getInitialProps</code> and <code class="notranslate">res.write</code> (as described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="200395417" data-permission-text="Title is private" data-url="https://github.com/vercel/next.js/issues/751" data-hovercard-type="issue" data-hovercard-url="/vercel/next.js/issues/751/hovercard?comment_id=272292486&amp;comment_type=issue_comment" href="https://github.com/vercel/next.js/issues/751#issuecomment-272292486">#751 (comment)</a>) to output plain text, because <code class="notranslate">res</code> isn't available during <code class="notranslate">next export</code>.</li>
</ul>
<p dir="auto">My only remaining ideas are to fork next.js, or to do extra steps after the next.js build process to add the necessary static files.</p>
<p dir="auto">Are there any better ways?</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>
<p dir="auto">Next deployments should work in IE11.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">My Next deployment does not work in IE11.</p>
<p dir="auto">The error is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="SCRIPT1053: Const must be initialized
File: main.s, Line: 1, Column 503674"><pre class="notranslate"><code class="notranslate">SCRIPT1053: Const must be initialized
File: main.s, Line: 1, Column 503674
</code></pre></div>
<p dir="auto">I looked at that place in <code class="notranslate">main.js</code>, which has this snippet--</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="... for(const e of Object.keys(o)) ..."><pre class="notranslate"><code class="notranslate">... for(const e of Object.keys(o)) ...
</code></pre></div>
<p dir="auto">I looked online, and apparently <a href="https://stackoverflow.com/questions/37799669/const-must-be-initialized-error-in-microsoft-edge-in-for-of-loop?rq=1" rel="nofollow">IE11 doesn't allow <code class="notranslate">const</code> or <code class="notranslate">let</code> in <code class="notranslate">for</code> loops</a>, like <code class="notranslate">for (const var ...</code>.</p>
<p dir="auto">I removed all these <code class="notranslate">for (const</code> and <code class="notranslate">for (let</code> forms from my code and redeployed, but got the same result. I believe it's because there are 9 modules in my <code class="notranslate">node_modules</code> that use the <code class="notranslate">for (const ...</code> form. I can't replace these modules.</p>
<p dir="auto">Is there some way to have next build the code and convert these <code class="notranslate">for (const</code> and <code class="notranslate">for (let</code> forms to <code class="notranslate">for (var</code> or <code class="notranslate">for (...</code> so I can support IE11?</p>
<p dir="auto">I am using Typescript, but I don't think that should make a difference.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<p dir="auto">Deploy any code with a <code class="notranslate">for (const</code> loop in it.</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.1.0</td>
</tr>
<tr>
<td>node</td>
<td>9.8.0</td>
</tr>
<tr>
<td>browser</td>
<td>IE version 11.0.9600.18860</td>
</tr>
</tbody>
</table>