Webpack config: Conditionally import module
<p>So I want to do: </p>

<pre><code>if (process.env.NODE_ENV === 'production') {
  import StatsPlugin from 'webpack-stats-plugin';
}
</code></pre>

<p>But eslint says:</p>

<pre><code>Parsing error: 'import' and 'export' may only appear at the top level
</code></pre>

<p>I'm using babel-eslint parser.</p>

<p>Does this imply I can't load modules conditionally?</p>