<p dir="auto">I couldn't find an existing tracking issue for this feature, please mark as a duplicate if I've missed anything.</p>
<p dir="auto">This is something that would be required for jspm support in Babel CLI, where we'd want to use dynamic <code class="notranslate">import()</code> to reference plugins directly, and so would need some kind of promise support in the configuration.</p>
<p dir="auto">Currently an asynchronous configuration gives the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error: You appear to be using an async configuration, which your current version of Babel does not support. We may add support for this in the future, but if you're on the most recent version of @babel/core and still seeing this error, then you'll need to synchronously return your config."><pre class="notranslate"><code class="notranslate">Error: You appear to be using an async configuration, which your current version of Babel does not support. We may add support for this in the future, but if you're on the most recent version of @babel/core and still seeing this error, then you'll need to synchronously return your config.
</code></pre></div>
<p dir="auto">And an asynchronous plugin gives the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="You appear to be using an async plugin, which your current version of Babel
does not support.If you're using a published plugin, you may need to upgrade your @babel/core version."><pre class="notranslate"><code class="notranslate">You appear to be using an async plugin, which your current version of Babel
does not support.If you're using a published plugin, you may need to upgrade your @babel/core version.
</code></pre></div>
<p dir="auto">Either or both of these features would be really great to support.</p>
<p dir="auto">The async plugin case effectively provides parity with top-level await workflows in future too. Happy to discuss further as well.</p>
<p dir="auto">Today I came across what looks like a bug.</p>
<p dir="auto">If you try to destructure arguments to a function that's within an array it silently fails instead of giving a SyntaxError.</p>
<p dir="auto">The failing code looks like:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const doesntCompileProperly = [
  ...args =&gt; console.log(args)
];"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">doesntCompileProperly</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
  ...<span class="pl-s1">args</span> <span class="pl-c1">=&gt;</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-s1">args</span><span class="pl-kos">)</span>
<span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">and compiles to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var doesntCompileProperly = [].concat(_toConsumableArray(function (args) {
  return console.log(args);
}));"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">doesntCompileProperly</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">.</span><span class="pl-en">concat</span><span class="pl-kos">(</span><span class="pl-en">_toConsumableArray</span><span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-s1">args</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">return</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-s1">args</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>
<p dir="auto">Here's a link to a few other examples in the Babel repl: <a href="http://babeljs.io/repl/#?experimental=false&amp;evaluate=true&amp;loose=false&amp;spec=false&amp;code=const%20compilesAsExpected%20%3D%20%5B%0A%20%20%28...args%29%20%3D%3E%20console.log%28args%29%0A%5D%3B%0A%0Aconst%20doesntCompileProperly%20%3D%20%5B%0A%20%20...args%20%3D%3E%20console.log%28args%29%0A%5D%3B%0A%0A%2F%2F%20const%20syntaxErrorInObject%20%3D%20%7B%0A%2F%2F%20%20%20something%3A%20...args%20%3D%3E%20console.log%28args%29%0A%2F%2F%20%7D%3B%0A%0A%2F%2F%20const%20syntaxErrorByItself%20%3D%20...args%20%3D%3E%20console.log%28args%29" rel="nofollow">babeljs.io repl link</a></p>