title: How to expose an es6 module globally
body: <p>I need to write a module that will be available on the window global.<br>
  I'm using es6 to create the module and every single class I define has it's own file.<br>
  I'm using webpack to babelify and bundle these classes.<br>
  The entry point of my module is also the file containing the global to be exposed.</p>
  
  <p><strong>I've tried every method to make this possibe, icluding:</strong>  </p>
  
  <ul>
  <li>expose-loader  </li>
  <li>import-loader  </li>
  <li>expoert-loader  </li>
  <li>output: library  </li>
  <li>black-magic :(</li>
  </ul>
  
  <p><strong>Example of code I've tried:</strong>  </p>
  
  <p>I want to get: window.MyMod</p>
  
  <pre><code>// mymod.js
  export class MyMod {
      constructor(aaa) {
          this.aaa = aaa;
      }
      toString() {
          return this.aaa;
      }
  }
  </code></pre>
  
  <p><p></p>
  
  <pre><code>// webpack.config
  var entries = [
      './src/mymod.js'
  ];
  module.exports = {
      ...,
      module: {
        loaders: [
              {
                  test: require.resolve('./src/mymod.js'),
                  loader: 'expose?MyMod'
              },
              {
                  test: /\.js$/,
                  exclude: /node_modules/,
                  loader: 'babel-loader',
                  query: {
                      presets: ['es2015']
                  }
              }
      ]
  }
  </code></pre>
  
  <p>This only gets me an object MyMod on the window that contains MyMod as a constructor.</p>
  
  <p>Any help will be appreciated.</p>