<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">@babel/cli</p>
<h3 dir="auto">Input code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const fn = async () /* test */ =&gt; {
};"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-en">fn</span> <span class="pl-c1">=</span> <span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c">/* test */</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">using <code class="notranslate">@babel/generator</code> version 7.20.0 and newer results in error</p>
<p dir="auto">last working version is <code class="notranslate">7.19.6</code></p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li><code class="notranslate">@babel/generator@7.20.0</code></li>
</ul>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto">also fails in <a href="https://babeljs.io/repl#?browsers=defaults%2C%20ie%2011%2C%20ie_mob%2011&amp;build=&amp;builtIns=false&amp;corejs=3.6&amp;spec=false&amp;loose=false&amp;code_lz=MYewdgzgLgBAZmGBeGBDCBPMwYAoCUMA9AFQxQCm0MJRyAfDAN4BQAvgNxA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=&amp;prettier=true&amp;targets=&amp;version=7.20.1&amp;externalPlugins=&amp;assumptions=%7B%7D" rel="nofollow">babel repl</a></p>
<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">babel-loader (webpack)</p>
<h3 dir="auto">Input code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { apiLogout } from &quot;../api&quot;;
import { reportError } from &quot;../libs/report_error&quot;;

export function logout() {
  return reportError(async (/*dispatch*/) =&gt; {
    await apiLogout();
    window.location.reload();
  });
}"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">apiLogout</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"../api"</span><span class="pl-kos">;</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">reportError</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"../libs/report_error"</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">logout</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</span> <span class="pl-en">reportError</span><span class="pl-kos">(</span><span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-c">/*dispatch*/</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">await</span> <span class="pl-en">apiLogout</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-smi">window</span><span class="pl-kos">.</span><span class="pl-c1">location</span><span class="pl-kos">.</span><span class="pl-en">reload</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto">babel.config.js</p>
<h3 dir="auto">Configuration</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module.exports = function(api) {
  const isTest = api.env('test');

  const envOptions = isTest
    ? {
      &quot;targets&quot;: {
        &quot;node&quot;: &quot;current&quot;
      }
    }
    : {
      modules: false,
      useBuiltIns: 'usage',
      corejs: &quot;3.25&quot;,
      // debug: true,
    };

  return {
    &quot;presets&quot;: [
      [&quot;@babel/preset-env&quot;, envOptions],
      &quot;@babel/preset-react&quot;
    ],
  };
};"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-en">exports</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-s1">api</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">isTest</span> <span class="pl-c1">=</span> <span class="pl-s1">api</span><span class="pl-kos">.</span><span class="pl-en">env</span><span class="pl-kos">(</span><span class="pl-s">'test'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-k">const</span> <span class="pl-s1">envOptions</span> <span class="pl-c1">=</span> <span class="pl-s1">isTest</span>
    ? <span class="pl-kos">{</span>
      <span class="pl-s">"targets"</span>: <span class="pl-kos">{</span>
        <span class="pl-s">"node"</span>: <span class="pl-s">"current"</span>
      <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
    : <span class="pl-kos">{</span>
      <span class="pl-c1">modules</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-c1">useBuiltIns</span>: <span class="pl-s">'usage'</span><span class="pl-kos">,</span>
      <span class="pl-c1">corejs</span>: <span class="pl-s">"3.25"</span><span class="pl-kos">,</span>
      <span class="pl-c">// debug: true,</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">"presets"</span>: <span class="pl-kos">[</span>
      <span class="pl-kos">[</span><span class="pl-s">"@babel/preset-env"</span><span class="pl-kos">,</span> <span class="pl-s1">envOptions</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-s">"@babel/preset-react"</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">After an upgrade from <code class="notranslate">7.19.3</code> to <code class="notranslate">7.19.6</code> I've got a following failure.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR in ./assets/actions/user.js 12:5
Module parse failed: Unexpected token (12:5)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export function logout() {
|   return reportError(async /*dispatch*/
&gt;   () =&gt; {
|     await apiLogout();
|     window.location.reload();
 @ ./assets/actions/index.js 2:0-37 12:13-24
 @ ./assets/app.js 6:0-37 12:15-23"><pre class="notranslate"><code class="notranslate">ERROR in ./assets/actions/user.js 12:5
Module parse failed: Unexpected token (12:5)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export function logout() {
|   return reportError(async /*dispatch*/
&gt;   () =&gt; {
|     await apiLogout();
|     window.location.reload();
 @ ./assets/actions/index.js 2:0-37 12:13-24
 @ ./assets/app.js 6:0-37 12:15-23
</code></pre></div>
<p dir="auto">Babel inserts a new line and breaks async closure (I guess, auto-insertion of semicolon is involved).</p>
<p dir="auto">The same error is reproducible in an online playground with other versions: <a href="https://babel.dev/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&amp;build=&amp;builtIns=false&amp;corejs=3.21&amp;spec=false&amp;loose=false&amp;code_lz=JYWwDg9gTgLgBAbzgQzMAMhA5hArvAXzgDMoIQ4AiAOmoHpVhKBuAKFElkTigFNOYAUShkocIqXJVadADbAARgGc6fAQH1eI6C1ateADwElcAOwDGMYBFNxZ2PDAAUASkSs4PXjFxRba6CFtKCdkJQBPCzgnOgAqABNgJTBkGHMAC1i6NwBeAD53T09kAHdkYHhGTBx8VzYiuBLgU3iIEup7c1TrU2o-e2R4uo9xFzYCViA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env%2Creact&amp;prettier=false&amp;targets=&amp;version=7.17.12&amp;externalPlugins=&amp;assumptions=%7B%7D" rel="nofollow">7.17.12 generates correct code</a> while <a href="https://babel.dev/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&amp;build=&amp;builtIns=false&amp;corejs=3.21&amp;spec=false&amp;loose=false&amp;code_lz=JYWwDg9gTgLgBAbzgQzMAMhA5hArvAXzgDMoIQ4AiAOmoHpVhKBuAKFElkTigFNOYAUShkocIqXJVadADbAARgGc6fAQH1eI6C1ateADwElcAOwDGMYBFNxZ2PDAAUASkSs4PXjFxRba6CFtKCdkJQBPCzgnOgAqABNgJTBkGHMAC1i6NwBeAD53T09kAHdkYHhGTBx8VzYiuBLgU3iIEup7c1TrU2o-e2R4uo9xFzYCViA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env%2Creact&amp;prettier=false&amp;targets=&amp;version=7.20.1&amp;externalPlugins=&amp;assumptions=%7B%7D" rel="nofollow">7.20.1 generates invalid code</a></p>
<h3 dir="auto">Environment</h3>
<h4 dir="auto">Environment w/o the issue</h4>
<p dir="auto">System:<br>
OS: Linux 6.0 Debian GNU/Linux bookworm/sid<br>
Binaries:<br>
Node: 14.20.0 - ~/apps/nodejs/bin/node<br>
Yarn: 1.22.19 - ~/apps/nodejs/bin/yarn<br>
npm: 6.14.17 - ~/apps/nodejs/bin/npm<br>
npmPackages:<br>
@babel/core: ^7 =&gt; 7.19.3<br>
@babel/eslint-parser: ^7 =&gt; 7.19.1<br>
@babel/preset-env: ^7 =&gt; 7.19.3<br>
@babel/preset-react: ^7 =&gt; 7.18.6<br>
babel-jest: ^29 =&gt; 29.1.2<br>
babel-loader: ^8.0.0 =&gt; 8.2.5<br>
eslint: ^8.2 =&gt; 8.24.0<br>
jest: ^29 =&gt; 29.1.2<br>
webpack: ^5 =&gt; 5.74.0</p>
<h4 dir="auto">Environment with the issue (after <code class="notranslate">yarn upgrade</code>)</h4>
<p dir="auto">System:<br>
OS: Linux 6.0 Debian GNU/Linux bookworm/sid<br>
Binaries:<br>
Node: 14.20.0 - ~/apps/nodejs/bin/node<br>
Yarn: 1.22.19 - ~/apps/nodejs/bin/yarn<br>
npm: 6.14.17 - ~/apps/nodejs/bin/npm<br>
npmPackages:<br>
@babel/core: ^7 =&gt; 7.19.6<br>
@babel/eslint-parser: ^7 =&gt; 7.19.1<br>
@babel/preset-env: ^7 =&gt; 7.19.4<br>
@babel/preset-react: ^7 =&gt; 7.18.6<br>
babel-jest: ^29 =&gt; 29.2.2<br>
babel-loader: ^8.0.0 =&gt; 8.2.5<br>
eslint: ^8.2 =&gt; 8.26.0<br>
jest: ^29 =&gt; 29.2.2<br>
webpack: ^5 =&gt; 5.74.0</p>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>