logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

production.js (2221B)


  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 sharedConfig = require('./shared.js');
  5. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  6. const OfflinePlugin = require('offline-plugin');
  7. const { publicPath } = require('./configuration.js');
  8. const path = require('path');
  9. module.exports = merge(sharedConfig, {
  10. output: {
  11. filename: '[name].js',
  12. chunkFilename: '[name].js',
  13. },
  14. devtool: 'source-map', // separate sourcemap file, suitable for production
  15. stats: 'normal',
  16. plugins: [
  17. new webpack.optimize.UglifyJsPlugin({
  18. sourceMap: true,
  19. mangle: true,
  20. compress: {
  21. warnings: false,
  22. },
  23. output: {
  24. comments: false,
  25. },
  26. }),
  27. new OfflinePlugin({
  28. publicPath: publicPath, // sw.js must be served from the root to avoid scope issues
  29. caches: {
  30. main: [':rest:'],
  31. additional: [':externals:'],
  32. optional: [
  33. '**/locale_*.js', // don't fetch every locale; the user only needs one
  34. '**/*_polyfills-*.js', // the user may not need polyfills
  35. '**/*.woff2', // the user may have system-fonts enabled
  36. // images/audio can be cached on-demand
  37. '**/*.png',
  38. '**/*.jpg',
  39. '**/*.jpeg',
  40. '**/*.svg',
  41. '**/*.mp3',
  42. '**/*.ogg',
  43. ],
  44. },
  45. externals: [
  46. '/emoji/1f602.svg', // used for emoji picker dropdown
  47. '/emoji/sheet.png', // used in emoji-mart
  48. ],
  49. excludes: [
  50. '**/*.map',
  51. 'stats.json',
  52. 'report.html',
  53. // any browser that supports ServiceWorker will support woff2
  54. '**/*.eot',
  55. '**/*.ttf',
  56. '**/*-webfont-*.svg',
  57. '**/*.woff',
  58. ],
  59. ServiceWorker: {
  60. entry: `imports-loader?process.env=>${encodeURIComponent(JSON.stringify(process.env))}!${encodeURI(path.join(__dirname, '../../app/javascript/mastodon/service_worker/entry.js'))}`,
  61. cacheName: 'mastodon',
  62. output: '../assets/sw.js',
  63. publicPath: '/sw.js',
  64. minify: true,
  65. },
  66. }),
  67. ],
  68. });