title: style-loader failing in React SSR
body: <p>Created reusable react library, currently it is working only in client side. If I try to run in server side, it will throw the below error because of <code>style-loader</code>. Basically I want to bundle both css and js into single file(UMD). So that it will be easy for the consumer. Is that possible? I thought about styled-component and emotion js, but not sure whether it will create any other dependency in the main app. Looking for better option to bundle it.</p>
  <pre><code>ReferenceError: window is not defined
  at t (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:1925)
  at B (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:2013)
  at A.exports (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:5558)
  at Object.&lt;anonymous&gt; (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:990)
  at s (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:62)
  at Module.&lt;anonymous&gt; (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:14364)
  at s (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:62)
  at /Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:861
  at Object.&lt;anonymous&gt; (/Users/srisukum/Documents/dev/react-library/react-reusable-lib/build/index.js:1:870)
  at Module._compile (internal/modules/cjs/loader.js:776:30)
  </code></pre>
  <p><strong>Webpack.config.js</strong></p>
  <pre><code>output: {
  path: path.resolve(__dirname, 'build'),
  filename: &quot;index.js&quot;,
  libraryTarget: 'commonjs2'
  },
  module: {
   rules: [
    {
      test: /\.js$/,
      exclude: /(node_modules|bower_components|build|dist)/,
      use: {
        loader: &quot;babel-loader&quot;
      }
    },
    {
      test: /\.css$/,
      use: [
        &quot;style-loader&quot;,
        {
          loader: &quot;css-loader&quot;,
          options: {
            modules: true
          }
        }
      ]
    },
    { 
      test: /\.(png|woff|woff2|eot|ttf|svg)$/, 
      loader: 'url-loader?limit=100000' 
    }
  ]
  },
  optimization: {
   minimizer: [
    new UglifyJsPlugin({
      cache: false,
      parallel: true,
      uglifyOptions: {
        compress: true,
        ecma: 6,
        mangle: true
      }
    })
   ]
  },
  externals: {
    'react': 'commonjs react'
  }
  </code></pre>