From 8f5fdab5bf681ff45a07965940bc45c9061a2f89 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Tue, 1 Jan 2019 02:11:48 +0900 Subject: Update dependencies for Node.js (2018-12-31) (#9669) * Update react-* to v16.7.0 * Upgrade react-hotkeys to v1.1.4 * Update react-intl to v2.7.2 * Update react-select to v2.2.0 * Update react-swipeable-views to v0.13.0 * Upgrade react-textarea-autosize to v7.1.0 * Upgrade redux to v4.0.1 * Upgrade reselect to v4.0.0 * Update raf to v3.4.1 * Update enzyme to v3.8.0 * Update rails-ujs to v5.2.2 * Update axios to v0.18.0 * Update http-link-header to v1.0.2 * Update rellax to v1.7.1 * Update intersection-observer to v0.5.1 * Update stringz to v1.0.0 * Upgrade babel-eslint to v10.0.1 * Update @babel/* to v7.2.x * Update babel-plugin-react-intl to v3.0.1 * Update babel-plugin-transform-react-remove-prop-types to v0.4.21 * Upgrade dotenv to v6.2.0 * Update express to v4.16.4 * Update webpack to v4.28.3 * Upgrade autoprefixer to v9.4.3 * Update babel-loader to v8.0.4 * Upgrade css-loader to v2.1.0 * Upgrade file-loader to v3.0.1 * Update marky to v1.2.1 * Update mini-css-extract-plugin to v0.5.0 * Update offline-plugin to v5.0.6 * Update style-loader to v0.23.1 * Update eslint-plugin-jsx-a11y to v6.1.2 * yarn upgrade * fix * Replace webpack-manifest-plugin to webpack-assets-manifest * Replace node-zopfli to @gfz/zopfli * Remove monkey-patch for http-link-header --- config/webpack/loaders/sass.js | 11 ++++++----- config/webpack/production.js | 15 ++++----------- config/webpack/shared.js | 9 ++++----- 3 files changed, 14 insertions(+), 21 deletions(-) (limited to 'config/webpack') diff --git a/config/webpack/loaders/sass.js b/config/webpack/loaders/sass.js index bad09ceb4..67a1890b8 100644 --- a/config/webpack/loaders/sass.js +++ b/config/webpack/loaders/sass.js @@ -1,22 +1,23 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const { env } = require('../configuration.js'); module.exports = { test: /\.s?css$/i, use: [ MiniCssExtractPlugin.loader, + 'css-loader', { - loader: 'css-loader', + loader: 'postcss-loader', options: { - minimize: env.NODE_ENV === 'production', + sourceMap: true, }, }, { - loader: 'postcss-loader', + loader: 'sass-loader', options: { + fiber: require('fibers'), + implementation: require('sass'), sourceMap: true, }, }, - 'sass-loader', ], }; 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 a1572665c..d6199373b 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 extname = require('path-complete-extname'); const { env, settings, themes, output, loadersDir } = require('./configuration.js'); const localePackPaths = require('./generateLocalePacks'); @@ -75,10 +75,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, }), ], -- cgit