title: React Webpack3: You may need an appropriate loader to handle this file type
body: <p>I am trying to use Webpack3 with Babel to compile ES6 assets, but I am getting an error "You may need an appropriate loader to handle this file type." Below is the exact error that I am getting:</p>
  
  <pre><code>ERROR in ./node_modules/use-global-hook/index.js
  Module parse failed: Unexpected token (2:18)
  You may need an appropriate loader to handle this file type.
  | function setState(store, newState, afterUpdateCallback) {
  |   store.state = { ...store.state, ...newState };
  |   store.listeners.forEach((listener) =&gt; {
  |     listener.run(store.state);
  @ ./src/components/dynamicLabel/store/index.js 11:21-47
  @ ./src/components/dynamicLabel/components/dynamicLabel.js
  @ ./src/components/dynamicLabel/index.js
  </code></pre>
  
  <p>Here is what my webpack.config.js looks like:</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
    devtool: 'source-map',
    entry: {
      csvparse: './src/components/csvparse',
      dateTime: './src/components/dateTime',
      gmoment: './src/components/gmoment',
      dynamicLabel: './src/components/dynamicLabel',
      gvideo: './src/components/gvideo',
      stickyScroll: './src/components/stickyScroll',
      webAccessibility: './src/components/webAccessibility'
    },
    output: {
      path: path.resolve(__dirname, 'lib'),
      filename: '[name]/index.js',
      libraryTarget: 'commonjs2'
    },
    resolve: {
      extensions: ['.js', '.jsx','.less']
    },
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          loader: 'babel-loader',
          exclude: /node_modules/
        },
  
        {
          test: /\.(?:le|c)ss$/,
          use: [
            require.resolve('style-loader'),
            {
              loader: require.resolve('css-loader'),
              options: {
                importLoaders: 1
              }
            },
            {
              loader: require.resolve('less-loader'),
              options: {
                importLoaders: 1
              }
            }
          ]
        }
      ]
    },
    externals: {
      'react': 'commonjs react'
    }
  };
  </code></pre>
  
  <p>Here is the babel object section in my package.json:</p>
  
  <pre><code>"babel": {
      "presets": [
        "es2015",
        "stage-2",
        "react"
      ],
      "plugins": [
        [
          "transform-runtime",
          {
            "regenerator": true
          }
        ]
      ]
    },
  </code></pre>
  
  <p>Could anyone please help me with this issue?</p>
  
  <p>Thank you in advance.</p>