title: npm webpack babel-loader error: Uncaught TypeError: n(...) is not a function
body: <p>I am trying to install babel-loader to be used with webpack</p>
  
  <p>I ran this command:</p>
  
  <pre><code>npm install -D babel-loader @babel/core @babel/preset-env webpack
  </code></pre>
  
  <p>Which installed:</p>
  
  <p>babel-loader@8.0.2
  @babel/core@7.1.0</p>
  
  <p>and webpack is 4.19.0</p>
  
  <p>webpack.config.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>module.exports = {
    context: __dirname + '/app',
    entry: './index.js',
    output: {
      path: __dirname + '/app',
      filename: 'bundle.js'
    },
  
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /(node_modules|bower_components)/,
          use: {
            loader: 'babel-loader',
            options: {
              presets: ['@babel/preset-env']
            }
          }
        }
      ]
    }
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>Then i tried to make a simple change on a javascript file just to check that it is using ES6</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>//before
  module.exports = function(ngModule) {
    require('./kcd-hello')(ngModule);
  };
  
  //currently
  export default ngModule =&gt; {
    require('./kcd-hello')(ngModule);
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>but I am getting the following javascript error:</p>
  
  <pre><code>Uncaught TypeError: n(...) is not a function
  </code></pre>
  
  <p>Can someone check what I am doing wrong?</p>
  
  <p>Many thanks in advance </p>
  
  <p>Regards</p>