<p dir="auto">I have followed the below steps to generate the bug.</p>
<ul dir="auto">
<li>I have created a file named after <code class="notranslate">server.ts</code> using the below command:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { serve } from &quot;https://deno.land/std@0.50.0/http/server.ts&quot;;
const s = serve({ port: 8000 });
console.log(&quot;http://localhost:8000/&quot;);
for await (const req of s) {
  req.respond({ body: &quot;Hello World\n&quot; });
}"><pre class="notranslate"><code class="notranslate">import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
  req.respond({ body: "Hello World\n" });
}
</code></pre></div>
<ul dir="auto">
<li>
<p dir="auto">I have tried to bundle the code using the below command:<br>
<code class="notranslate">deno bundle server.ts server.bundle.js</code></p>
</li>
<li>
<p dir="auto">Then I have tried to run the bundled code using the below command:<br>
<code class="notranslate">deno run server.bundle.js</code></p>
</li>
</ul>
<p dir="auto">After that, I have found the below issue into the terminal</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Uncaught SyntaxError: Unexpected reserved word
        for await (const req of s) {
            ~~~~~
    at file:///Projects/Personal/server.bundle.js:5467:13"><pre class="notranslate"><code class="notranslate">error: Uncaught SyntaxError: Unexpected reserved word
        for await (const req of s) {
            ~~~~~
    at file:///Projects/Personal/server.bundle.js:5467:13
</code></pre></div>
<h2 dir="auto">Steps to reproduce</h2>
<p dir="auto">Create <code class="notranslate">server.js</code> with the following content:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { serve } from &quot;https://deno.land/std@v0.35.0/http/server.ts&quot;;
const s = serve({ port: 8000 });
console.log(&quot;http://localhost:8000/&quot;);
for await (const req of s) {
  req.respond({ body: &quot;Hello World\n&quot; });
}"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">serve</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://deno.land/std@v0.35.0/http/server.ts"</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-en">serve</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">port</span>: <span class="pl-c1">8000</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"http://localhost:8000/"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">for</span> <span class="pl-k">await</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">req</span> <span class="pl-k">of</span> <span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">req</span><span class="pl-kos">.</span><span class="pl-en">respond</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">body</span>: <span class="pl-s">"Hello World\n"</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">Run <code class="notranslate">deno bundle server.js out.js</code></p>
<p dir="auto">Run <code class="notranslate">deno out.js</code></p>
<h2 dir="auto">Expected result</h2>
<p dir="auto">The code runs</p>
<h2 dir="auto">Actual result</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="error: Uncaught SyntaxError: Unexpected reserved word
► file:///path/to/out.js:113:17

113             for await (const req of s) {
                    ~~~~~"><pre class="notranslate">error: Uncaught SyntaxError: Unexpected reserved word
► file:///path/to/out.js:113:17

113             <span class="pl-k">for</span> await (const req of s) {
                    <span class="pl-k">~</span>~~~~</pre></div>
<h2 dir="auto">Notes</h2>
<p dir="auto">Adding <code class="notranslate">await console.log("test");</code> or any other <code class="notranslate">await</code> statement is detected by the bundler and allows the <code class="notranslate">for-await</code> block to work properly. (See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="573538419" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/4206" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/4206/hovercard" href="https://github.com/denoland/deno/issues/4206">#4206</a>)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="deno 0.35.0
v8 8.1.310
typescript 3.8.2"><pre class="notranslate"><code class="notranslate">deno 0.35.0
v8 8.1.310
typescript 3.8.2
</code></pre></div>