title: Exposing React Components using Webpack
body: <p>So I am trying to expose all my React components in the bundle to global of the browser (<code>window</code>). I am using the webpack's <code>expose-loader</code> to do so.</p>
  
  <p>I have full success in exposing plain JS modules but when I try to expose JSX modules, it gives me an error:</p>
  
  <pre><code>Module parse failed: ~/project/src/components/list.jsx Line 20: Unexpected token &lt;
  You may need an appropriate loader to handle this file type.
  ...
  </code></pre>
  
  <p>The error only shows up for the 3rd loader entry that uses <code>expose</code>. If that loaders entry is removed, React components build just fine.</p>
  
  <p>Here's the webpack config file:</p>
  
  <pre><code>module.exports = {
    entry: "./src/components/index.js",
  
    output: {
      filename: "bundle.js",
      path: __dirname + "/web"
    },
  
    module: {
      loaders: [
        {
          test: /\.jsx$/,
          exclude: /node_modules/,
          loaders: ["babel-loader?presets[]=react,presets[]=es2015"],
        },
        {
          test: require.resolve("react"),
          loader: "expose?React"
        },
        {
          test: /list.jsx$/,
          loaders: ["babel-loader?presets[]=react,presets[]=es2015", "expose?List"]
        }
      ]
    }
  };
  </code></pre>
  
  <p>I have tried to use <code>babel-loader</code> before the <code>expose</code> loader to try to fix the error but no luck, same error. Has anyone had any success exposing React components globally using web pack before.</p>