RegEx in Webpack loader exclude/include config doesn't work
<p>I am trying to apply <code>babel-loader</code> to a specific pattern of modules, say <strong>foo.*</strong>, under <strong>node_modules</strong> in addition to my app. </p>

<p>Other modules under <strong>node_modules</strong> should be skipped as usual. First I tried to use negative look-ahead didn't work:</p>

<pre><code>{
  test: /\.js$/,
  exclude: [
    /node_modules\/(?!foo).*/
  ],
  loader: 'babel-loader',
  query: {
    ...
  }
}, 
</code></pre>

<p>Then I splited to two loaders and didn't work either:</p>

<pre><code>{
  test: /\.js$/,
  exclude: [
    path.resolve(_path, "node_modules")
  ],
  loader: 'babel-loader',
  query: {
    ...
  }
}, 
{
  test: /\.js$/,
  include: [
    /node_modules\/foo.*/
  ],
  loader: 'babel-loader',
  query: {
    ...
  }
}
</code></pre>

<p>However, if I use string instead of RegEx, it works for one folder:</p>

<pre><code>include: [
  path.resolve(_path, "node_modules/foo")
],
</code></pre>

<p>This indicates to me the <strong>Regex</strong> is not working as expected.</p>

<p>Has anyone got <strong>RegEx</strong> working in <code>Include/Exclude</code> field?</p>