title: compression webpack bundle using plugin
body: <p>I am trying to compressed webpack bundle using CompressionPlugin.
  below my webpack setup</p>
  
  <p>webpack </p>
  
  <pre><code>const path = require('path');
  const webpack = require('webpack');
  
  const CompressionPlugin = require("compression-webpack-plugin")
  
  
  module.exports = {
  entry: ['babel-polyfill', './src/client.js'],
  output: {
      filename: 'bundle.js',
      path: path.resolve(__dirname,'public')
  },
  
  plugins: [
      new webpack.DefinePlugin({ 
          'process.env': {
          'NODE_ENV': JSON.stringify('production'),
  
          }
      }),
      new webpack.optimize.UglifyJsPlugin({
                  output: {
                      comments: false,
                      beautify: false,
                  },
                  compress: {
                      screw_ie8: true,
                      warnings: false
                      }
                  }),
      new webpack.optimize.AggressiveMergingPlugin(),
      new CompressionPlugin({   
          asset: "[path].gz[query]",
          algorithm: "gzip",
          test: /\.js$|\.css$|\.html$/,
          threshold: 10240,
          minRatio: 0.8
      })
  ],
  watch: true,
  module:{
      loaders:[
          {
              test:/\.js$/,
              exclude:/node_modules/,
              loader: 'babel-loader',
              query:{
                  presets: ['react','es2015','stage-1'],
              },
          },
      ],
  },
  };
  </code></pre>
  
  <p>www</p>
  
  <pre><code>var port = normalizePort(process.env.PORT || '3000');
  app.set('port', port);
  
  
  var server = http.createServer(app);
  
  server.listen(port);
  server.on('error', onError);
  server.on('listening', onListening);
  </code></pre>
  
  <p>index.ejs </p>
  
  <pre><code>&lt;body&gt;
      &lt;DIV id="app"&gt;&lt;%- reactComponent -%&gt;&lt;/DIV&gt;
      &lt;script&gt;window.INITIAL_STATE=&lt;%- initialState -%&gt;&lt;/script&gt;
      &lt;SCRIPT src="/bundle.js"&gt;&lt;/SCRIPT&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>i am getting the following bundle output 
  <a href="https://i.stack.imgur.com/5Sihz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5Sihz.png" alt="enter image description here"></a></p>
  
  <p>everything seems to work but i am not sure if i am doing it in the corrct way,
  I am not sure if it actually configured to use bundle.js.gz</p>