title: Can exporting webpack 2 config as a function prevent transpiling?
body: <p>I am new to webpack and attempting to use it together with the Babel loader to write a library in ES6. I also want to use Karma/PhantomJS for a testing pipeline.</p>
  
  <p>I have hit an odd issue where PhantomJS indicates that ES6 code didn't get converted when I run the tests:</p>
  
  <pre><code>SyntaxError: Use of reserved word 'let' in strict mode
  at webpack:///say/hello.js:2:0 &lt;- say/hello.spec.js:22929
  </code></pre>
  
  <p>But this only happens when I export my webpack config as a function (to take advantage of environment as per <a href="https://webpack.js.org/configuration/configuration-types/#exporting-a-function-to-use-env" rel="nofollow noreferrer">https://webpack.js.org/configuration/configuration-types/#exporting-a-function-to-use-env</a>). Exporting config as an object is fine.</p>
  
  <p>I have made a public repo to help others reproduce this at <a href="https://github.com/agentreno/es6-library-example" rel="nofollow noreferrer">https://github.com/agentreno/es6-library-example</a> with the npm 'test' and 'test:broken' tasks to demonstrate. I would greatly appreciate any assistance.</p>