webpack.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // For instructions about this file refer to
  2. // webpack and webpack-hot-middleware documentation
  3. var webpack = require('webpack');
  4. var path = require('path');
  5. var CompressionPlugin = require("compression-webpack-plugin");
  6. module.exports = {
  7. devtool: 'source-map',
  8. context: path.join(__dirname, 'app', 'js'),
  9. entry: [
  10. './main'
  11. ],
  12. output: {
  13. path: path.join(__dirname, 'app', 'dist'),
  14. filename: 'bundle.js'
  15. },
  16. plugins: [
  17. new webpack.optimize.OccurenceOrderPlugin(),
  18. new webpack.NoErrorsPlugin(),
  19. new CompressionPlugin({
  20. asset: "[path].gz[query]",
  21. algorithm: "gzip",
  22. test: /\.js$/,
  23. threshold: 10240,
  24. minRatio: 0.8
  25. }),
  26. new webpack.optimize.UglifyJsPlugin({
  27. compress: {
  28. warnings: false
  29. },
  30. mangle: true
  31. })
  32. ],
  33. resolve: {
  34. extensions: ['', '.jsx', '.js']
  35. },
  36. module: {
  37. loaders: [
  38. {
  39. test: /\.jsx?$/,
  40. exclude: /node_modules/,
  41. loaders: ['babel']
  42. }
  43. ]
  44. }
  45. };