title: Brunch builds but "Cannot find module 'buffer'" on open
body: <p>We are attempting to transition our front end build to use Brunch. Here's the Brunch configuration I have so far:</p>
  
  <pre><code>module.exports = {
  
    files: {
      javascripts: {
        joinTo: {
          'vendor.js': /^(?!source)/,
          'app.js': /^source/
        },
        entryPoints: {
          'source/scripts/app.jsx': 'app.js'
        }
      },
      stylesheets: {joinTo: 'core.css'},
    },
  
    paths: {
      watched: ['source']
    },
  
    modules: {
      autoRequire: {
        'app.js': ['source/scripts/app']
      }
    },
  
    plugins: {
      babel: {presets: ['latest', 'react']},
      postcss: {processors: [require('autoprefixer')]},
      assetsmanager: {
        copyTo: {
          'assets': ['source/resources/*']
        }
      },
      static: {
        processors: [
          require('html-brunch-static')({
            processors: [
              require('pug-brunch-static')({
                fileMatch: 'source/views/home.pug',
                fileTransform: (filename) =&gt; {
                  filename = filename.replace(/\.pug$/, '.html');
                  filename = filename.replace('views/', '');
                  return filename;
                }
              })
            ]
          })
        ]
      }
  
    }
  
  };
  </code></pre>
  
  <p>I added the <code>modules.autoRequire</code> section to the Brunch configuration and then the following error started happening. Without <code>modules.autoRequire</code> I have no console error but also my web app does not start. Running <code>brunch build</code> results in no errors, but when I open the built website, I get the error</p>
  
  <blockquote>
    <p>Uncaught Error: Cannot find module 'buffer' from 'lodash/lodash.js'</p>
  </blockquote>
  
  <p>The first line in the stacktrace points me to this function in vendor.js</p>
  
  <pre><code>var require = function(name, loaderPath) {
    if (loaderPath == null) loaderPath = '/';
    var path = expandAlias(name);
  
    if (has.call(cache, path)) return cache[path].exports;
    if (has.call(modules, path)) return initModule(path, modules[path]);
  
    throw new Error("Cannot find module '" + name + "' from '" + loaderPath + "'");
  };
  </code></pre>
  
  <p>I'm not sure how to proceed to get my build working. This <a href="https://github.com/brunch/brunch/issues/1293" rel="nofollow noreferrer">issue</a> seems like it may be relevant.</p>
  
  <p>How can I overcome this error? (Please feel free to ask for additional information. I'm not sure what all would be helpful.)</p>