闭社主体 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.

42 lines
1.2 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. devtool: 'source-map', // separate sourcemap file, suitable for production
  9. output: { filename: '[name]-[chunkhash].js' },
  10. plugins: [
  11. new webpack.optimize.UglifyJsPlugin({
  12. compress: true,
  13. mangle: true,
  14. output: {
  15. comments: false,
  16. },
  17. sourceMap: true,
  18. }),
  19. new CompressionPlugin({
  20. asset: '[path].gz[query]',
  21. algorithm: 'gzip',
  22. test: /\.(js|css|svg|eot|ttf|woff|woff2)$/,
  23. }),
  24. new BundleAnalyzerPlugin({ // generates report.html and stats.json
  25. analyzerMode: 'static',
  26. generateStatsFile: true,
  27. statsOptions: {
  28. // allows usage with http://chrisbateman.github.io/webpack-visualizer/
  29. chunkModules: true,
  30. },
  31. openAnalyzer: false,
  32. logLevel: 'silent', // do not bother Webpacker, who runs with --json and parses stdout
  33. }),
  34. ],
  35. });