diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-03-16 13:52:55 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-03-16 14:14:20 +0100 |
commit | 4df3b7cb067797982199c3e613ba32a9c7474348 (patch) | |
tree | bf237d385411f73e670af4c744d8239ab4799434 /config/webpack/production.js | |
parent | c2fa0f7c40bcc4064e8baaa221665eadd391c001 (diff) | |
parent | 1a0d3c9c65d663210494ec9b55912debad6331f5 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/settings/follower_domains_controller.rb Removed upstream. Did the same here. Maybe we should not have? - config/locales/en.yml Upstream removed the “Authorized followers” page and associated translations. This is too close in the file to our glitch-soc-specific “flavour” string. No actual conflict. - config/locales/ja.yml Same as above. - config/locales/pl.yml Same as above. - config/navigation.rb No real conflict. New route added too close to the glitch-soc-specific “flavours” one. - config/webpack/configuration.js Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up. - config/webpack/loaders/babel.js Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up. The contents of this file have been moved to package.json. - config/webpack/shared.js Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up. - config/webpacker.yml Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up. - jest.config.js The contents of this file have been moved to package.json. - package.json Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up. - yarn.lock Upstream refactored the webpack(er) configuration quite a bit. Tried to keep up.
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:'], |