diff options
author | Reverite <github@reverite.sh> | 2019-03-21 15:35:55 -0700 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-03-21 15:35:55 -0700 |
commit | 592735fd80acd0aeffb5a5674255ed48d7a8db0b (patch) | |
tree | 0eefc67f624a07df0af860edecd68d5dc64c7ee9 /config/webpack/production.js | |
parent | 75eeb003b09c53d3b4e98046d1c20b0ad8a887bb (diff) | |
parent | bde9196b70299405ebe9b16500b7a3f65539b2c3 (diff) |
Merge remote-tracking branch 'glitch/master' into production
Diffstat (limited to 'config/webpack/production.js')
-rw-r--r-- | config/webpack/production.js | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/config/webpack/production.js b/config/webpack/production.js index d37e11792..c829ff6f1 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -1,15 +1,14 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect +const path = require('path'); +const { URL } = require('url'); const merge = require('webpack-merge'); +const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); +const OfflinePlugin = require('offline-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin'); -const zopfli = require('@gfx/zopfli'); -const sharedConfig = require('./shared.js'); -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; -const OfflinePlugin = require('offline-plugin'); -const { publicPath } = require('./configuration.js'); -const path = require('path'); -const { URL } = require('url'); +const { output } = require('./configuration'); +const sharedConfig = require('./shared'); let attachmentHost; @@ -28,15 +27,9 @@ if (process.env.S3_ENABLED === 'true') { module.exports = merge(sharedConfig, { mode: 'production', - - output: { - filename: '[name]-[chunkhash].js', - chunkFilename: '[name]-[chunkhash].js', - }, - - devtool: 'source-map', // separate sourcemap file, suitable for production + devtool: 'source-map', stats: 'normal', - + bail: true, optimization: { minimize: true, minimizer: [ @@ -60,23 +53,17 @@ module.exports = merge(sharedConfig, { plugins: [ new CompressionPlugin({ - algorithm(input, compressionOptions, callback) { - return zopfli.gzip(input, compressionOptions, callback); - }, - test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/, + filename: '[path].gz[query]', + cache: true, + test: /\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/, }), - new BundleAnalyzerPlugin({ // generates report.html and stats.json + new BundleAnalyzerPlugin({ // generates report.html analyzerMode: 'static', - generateStatsFile: true, - statsOptions: { - // allows usage with http://chrisbateman.github.io/webpack-visualizer/ - chunkModules: true, - }, openAnalyzer: false, logLevel: 'silent', // do not bother Webpacker, who runs with --json and parses stdout }), new OfflinePlugin({ - publicPath: publicPath, // sw.js must be served from the root to avoid scope issues + publicPath: output.publicPath, // sw.js must be served from the root to avoid scope issues caches: { main: [':rest:'], additional: [':externals:'], |