<p dir="auto">When building an application compiled using babel, lots of developer use the <code class="notranslate">runtime</code> transformer but still requires the polyfills for ES6+ definitions. The application's package is generally similar to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;dependencies&quot;: {
    &quot;babel-runtime&quot;: &quot;^5.0.0&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;babel&quot;: &quot;^5.0.0&quot;
  },
  &quot;scripts&quot;: {
    &quot;build&quot;: &quot;babel -d lib src&quot;
  }
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"dependencies"</span>: <span class="pl-kos">{</span>
    <span class="pl-s">"babel-runtime"</span>: <span class="pl-s">"^5.0.0"</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-s">"devDependencies"</span>: <span class="pl-kos">{</span>
    <span class="pl-s">"babel"</span>: <span class="pl-s">"^5.0.0"</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-s">"scripts"</span>: <span class="pl-kos">{</span>
    <span class="pl-s">"build"</span>: <span class="pl-s">"babel -d lib src"</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Unfortunately the polyfills are located at <code class="notranslate">babel/runtime</code> which requires the developer to specify <code class="notranslate">babel</code> as dependencies (not a dev one) if he want to use it. Adding the polyfills to <code class="notranslate">babel-runtime</code> would solve this issue.</p>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong><br>
Error while compile:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ babel index.js
Error: We don't know what to do with this node type. We were previously a Statement but we can't fit in here?
    at NodePath.insertBefore (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\modification.js:55:11)
    at PluginPass.Class (C:\workspace\babel-bug-report\node_modules\@babel\plugin-proposal-class-properties\lib\index.js:257:14)
    at newFn (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\visitors.js:237:21)
    at NodePath._call (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:65:20)
    at NodePath.call (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:40:17)
    at NodePath.visit (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:100:12)
    at TraversalContext.visitQueue (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:142:16)
    at TraversalContext.visitSingle (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:102:19)
    at TraversalContext.visit (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:182:19)
    at Function.traverse.node (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\index.js:106:17)"><pre class="notranslate"><code class="notranslate">$ babel index.js
Error: We don't know what to do with this node type. We were previously a Statement but we can't fit in here?
    at NodePath.insertBefore (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\modification.js:55:11)
    at PluginPass.Class (C:\workspace\babel-bug-report\node_modules\@babel\plugin-proposal-class-properties\lib\index.js:257:14)
    at newFn (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\visitors.js:237:21)
    at NodePath._call (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:65:20)
    at NodePath.call (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:40:17)
    at NodePath.visit (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\path\context.js:100:12)
    at TraversalContext.visitQueue (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:142:16)
    at TraversalContext.visitSingle (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:102:19)
    at TraversalContext.visit (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\context.js:182:19)
    at Function.traverse.node (C:\workspace\babel-bug-report\node_modules\@babel\traverse\lib\index.js:106:17)
</code></pre></div>
<p dir="auto"><strong>Input Code</strong><br>
Repo: <a href="https://github.com/tihonove/babel-bug-report">https://github.com/tihonove/babel-bug-report</a></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class Foo {
    static bar = {};
    constructor(b) {}
    foo = b =&gt; b;
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-k">static</span> <span class="pl-c1">bar</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">constructor</span><span class="pl-kos">(</span><span class="pl-s1">b</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
    <span class="pl-c1">foo</span> <span class="pl-c1">=</span> <span class="pl-s1">b</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">b</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Babel Configuration (.babelrc, package.json, cli command)</strong></p>
<p dir="auto">.babelrc:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;presets&quot;: [
        &quot;@babel/es2015&quot;
    ],
    &quot;plugins&quot;: [
        &quot;@babel/proposal-class-properties&quot;
    ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
    <span class="pl-s">"presets"</span>: <span class="pl-kos">[</span>
        <span class="pl-s">"@babel/es2015"</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-s">"plugins"</span>: <span class="pl-kos">[</span>
        <span class="pl-s">"@babel/proposal-class-properties"</span>
    <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">command:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="yarn babel index.js"><pre class="notranslate"><code class="notranslate">yarn babel index.js
</code></pre></div>
<p dir="auto"><strong>Environment</strong></p>
<ul dir="auto">
<li>Babel version(s): v7.0.0-beta.47</li>
<li>Node/npm version: v8.6.0/5.3.0</li>
<li>OS: Windows 10</li>
<li>Monorepo: yes</li>
<li>How you are using Babel: cli or loader</li>
</ul>