闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

  1. // Note: You must restart bin/webpack-dev-server for changes to take effect
  2. const webpack = require('webpack');
  3. const merge = require('webpack-merge');
  4. const CompressionPlugin = require('compression-webpack-plugin');
  5. const sharedConfig = require('./shared.js');
  6. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  7. module.exports = merge(sharedConfig, {
  8. output: { filename: '[name]-[chunkhash].js' },
  9. devtool: 'source-map', // separate sourcemap file, suitable for production
  10. stats: 'normal',
  11. plugins: [
  12. new webpack.optimize.ModuleConcatenationPlugin(),
  13. new webpack.optimize.UglifyJsPlugin({
  14. sourceMap: true,
  15. mangle: true,
  16. compress: {
  17. warnings: false,
  18. },
  19. output: {
  20. comments: false,
  21. },
  22. }),
  23. new CompressionPlugin({
  24. asset: '[path].gz[query]',
  25. algorithm: 'gzip',
  26. test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/,
  27. }),
  28. new BundleAnalyzerPlugin({ // generates report.html and stats.json
  29. analyzerMode: 'static',
  30. generateStatsFile: true,
  31. statsOptions: {
  32. // allows usage with http://chrisbateman.github.io/webpack-visualizer/
  33. chunkModules: true,
  34. },
  35. openAnalyzer: false,
  36. logLevel: 'silent', // do not bother Webpacker, who runs with --json and parses stdout
  37. }),
  38. ],
  39. });