title: Webpack 2: How to exclude all node_modules except for
body: <p>I need to have babel run on <code>/node_modules/identicons/</code> However I still want to exclude all other packages.</p>
  
  <p>Reason is <strong><a href="https://github.com/blog/1586-identicons" rel="noreferrer">the identicons package</a></strong> is using template strings and breaks when I run</p>
  
  <p><code>"webpack -p"</code></p>
  
  <p>String in question (node_modules/identicons/index.js):</p>
  
  <pre><code>str += `&lt;rect x="${x}" y="${y}" width="${xside}" height="${xside}" style="fill:${color}" /&gt;`
  </code></pre>
  
  <h2>Webpack.config.babel</h2>
  
  <pre><code>module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        //include: /node_modules/identicons/,
        use: ["babel-loader"]
      },
  </code></pre>
  
  <p>How would that pattern be written?</p>