diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-01-02 13:45:18 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-01-02 15:36:53 +0100 |
commit | 571d219bb917cefcca7419a0ad4e3889689d5f6a (patch) | |
tree | 6ab91adcb2c164fd027708e58f5fb96c52474007 /config/webpack | |
parent | b300948526d967aaf5608c93546ee0d54940c0ef (diff) | |
parent | 66436d08959998be20c6c6bf631177d8c1f3e0d1 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts manually resolved: - app/services/post_status_service.rb - config/locales/simple_form.pl.yml - config/routes.rb - config/webpack/loaders/sass.js - config/webpack/shared.js - package.json - yarn.lock
Diffstat (limited to 'config/webpack')
-rw-r--r-- | config/webpack/loaders/sass.js | 11 | ||||
-rw-r--r-- | config/webpack/production.js | 15 | ||||
-rw-r--r-- | config/webpack/shared.js | 9 |
3 files changed, 12 insertions, 23 deletions
diff --git a/config/webpack/loaders/sass.js b/config/webpack/loaders/sass.js index 920d5350f..5a96096bd 100644 --- a/config/webpack/loaders/sass.js +++ b/config/webpack/loaders/sass.js @@ -1,16 +1,10 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const { env } = require('../configuration.js'); module.exports = { test: /\.s?css$/i, use: [ MiniCssExtractPlugin.loader, - { - loader: 'css-loader', - options: { - minimize: env.NODE_ENV === 'production', - }, - }, + 'css-loader', { loader: 'postcss-loader', options: { @@ -21,6 +15,9 @@ module.exports = { loader: 'sass-loader', options: { includePaths: ['app/javascript'], + fiber: require('fibers'), + implementation: require('sass'), + sourceMap: true, }, }, ], diff --git a/config/webpack/production.js b/config/webpack/production.js index 30147cfe3..d37e11792 100644 --- a/config/webpack/production.js +++ b/config/webpack/production.js @@ -3,6 +3,7 @@ const merge = require('webpack-merge'); 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'); @@ -10,16 +11,6 @@ const { publicPath } = require('./configuration.js'); const path = require('path'); const { URL } = require('url'); -let compressionAlgorithm; -try { - const zopfli = require('node-zopfli'); - compressionAlgorithm = (content, options, fn) => { - zopfli.gzip(content, options, fn); - }; -} catch (error) { - compressionAlgorithm = 'gzip'; -} - let attachmentHost; if (process.env.S3_ENABLED === 'true') { @@ -69,7 +60,9 @@ module.exports = merge(sharedConfig, { plugins: [ new CompressionPlugin({ - algorithm: compressionAlgorithm, + algorithm(input, compressionOptions, callback) { + return zopfli.gzip(input, compressionOptions, callback); + }, test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/, }), new BundleAnalyzerPlugin({ // generates report.html and stats.json diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 58eab4b4c..938bab9f5 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -4,7 +4,7 @@ const webpack = require('webpack'); const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const ManifestPlugin = require('webpack-manifest-plugin'); +const AssetsManifestPlugin = require('webpack-assets-manifest'); const { env, settings, core, flavours, output, loadersDir } = require('./configuration.js'); const localePacks = require('./generateLocalePacks'); @@ -100,10 +100,9 @@ module.exports = { new MiniCssExtractPlugin({ filename: env.NODE_ENV === 'production' ? '[name]-[contenthash].css' : '[name].css', }), - new ManifestPlugin({ - publicPath: output.publicPath, - writeToFileEmit: true, - filter: file => !file.isAsset || file.isModuleAsset, + new AssetsManifestPlugin({ + publicPath: true, + writeToDisk: true, }), ], |