title: Tree-shaking and externalize helpers in brunch
body: <p>I look at the output of my brunch/babel setup, and wonder if some things couldn't be optimized. Here is the <code>brunch-config.js</code> I will use as support for my questions:</p>
  
  <pre><code>module.exports = {
    files: {
      javascripts: {
        joinTo: {
          'vendor.js': /^(?!app)/,
          'app.js': /^app/
        }
      }
    },
    modules: {
      autoRequire: {
        'app.js': [ 'main.js' ] // my entry point
      }
    }
  }
  </code></pre>
  
  <p>First, when using a module (using import/export), the whole is included even when things aren't used. For example, as a proof of concept, my <code>main.js</code> only includes this:</p>
  
  <pre><code>import Vue from 'vue'
  
  console.log('running')
  </code></pre>
  
  <p>My <code>vendor.js</code> then contains all the <code>vue</code> package content. I know there are tree-shaking possibilities in other bundlers (rollup does it well from scratch). I searched but couldn't find plugins in brunch for that.</p>
  
  <p>My second point is about the code generated. I'm not sure if it comes from brunch or babel though. Both <code>vendor.js</code> and <code>app.js</code> contain the same tooling code to enable commonjs modules (aka require). Couldn't be that code only included in one bundle (let's say vendor)?</p>