title: Babel not transpiling ES6 module in node_modules despite proper exclude
body: <p>In a react project I used react-boilerplate but had private modules to include in the frontend that needed transpiling. In order for babel to transpile those I set exclude to the following function in the webpack config that relates to babel:</p>
  
  <pre><code>rules: [
    {
      test: /\.js$/, // Transform all .js files required somewhere with Babel
      // eslint-disable-next-line object-shorthand, func-names
      exclude: function (modulePath) {
        return /node_modules/.test(modulePath) &amp;&amp;
            !/node_modules\/@trade-quorum\/tq-helpers/.test(modulePath);
      },
      use: {
        loader: 'babel-loader',
        options: options.babelQuery,
      },
    },
  </code></pre>
  
  <p>And it worked perfectly.</p>
  
  <p>Now I used that same trick in a different project but this time, in the resulting bundle tq-helpers is included but not transpiled into ES5 - the ES6 code is directly in the bundle and the build raises an error (more specifically UglifyJS).</p>
  
  <p>There must be a reason around the dependencies to this package that are not the same in the two projects but hard to find. I was wondering whether there is a way to debug in details what babel does for a specific package in order to find the reason. </p>
  
  <p>Thanks you for your help,</p>
  
  <p>Best,</p>
  
  <p>Didier</p>