title: How to fix Module parse failed: Unexpected token?
body: <p>When I run <code>npm run build</code> I got this error:</p>
  
  <pre><code>ERROR in ./src/client.js 7:2
  Module parse failed: Unexpected token (7:2)
  File was processed with these loaders:
   * ./node_modules/jshint-loader/index.js
  You may need an additional loader to handle the result of these loaders.
  | 
  | const component = (
  &gt;   &lt;Router history={browserHistory}&gt;
  |     {routes}
  |   &lt;/Router&gt;
   @ multi babel-polyfill ./src/client.js main[1]
  </code></pre>
  
  <p><strong>./src/client.js</strong> (with warning for <code>browserHistory</code> -- Cannot resolve symbol 'browserHistory' )</p>
  
  <pre><code>import React      from 'react';
  import ReactDOM   from 'react-dom';
  import { browserHistory, Router } from 'react-router';
  import routes from './routes';
  
  const component = (
    &lt;Router history={browserHistory}&gt;
      {routes}
    &lt;/Router&gt;
  );
  
  ReactDOM.render(component, document.getElementById('react-view'));
  </code></pre>
  
  <p>How can I fix it?</p>
  
  <blockquote>
    <p>react: 16.13.0 </p>
    
    <p>webpack: 4.42.0</p>
    
    <p>npm: 6.14.2</p>
  </blockquote>
  
  <p><strong>webpack-config.js</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>global.Promise         = require('bluebird');
  const webpack            = require('webpack');
  const path               = require('path');
  
  const plugins = [
    new webpack.DefinePlugin({
      'process.env': {
        BROWSER:  JSON.stringify(true),
        NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
      }
    })
  ];
  
  module.exports = {
    entry: ['babel-polyfill', './src/client.js'],
    output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname, 'dist')
    },
  
    module: {
      rules: [{
        test: /\.js$/, // include .js files
        enforce: "pre", // preload the jshint loader
        exclude: /node_modules/, // exclude any and all files in the node_modules folder
        use: [{
          loader: "jshint-loader",
          // more options in the optional jshint object
          options: {  // ⬅ formally jshint property
            camelcase: true,
            emitErrors: false,
            failOnHint: false
          }
        }]
      }]
    }
  };
  </code></pre>