mirror of https://github.com/zulip/zulip.git
webpack: Switch to css-minimizer-webpack-plugin.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
2ce24bcd2b
commit
6bc3b267e1
|
@ -26,6 +26,7 @@
|
|||
"clipboard": "^2.0.4",
|
||||
"core-js": "^3.6.5",
|
||||
"css-loader": "^5.0.0",
|
||||
"css-minimizer-webpack-plugin": "^1.3.0",
|
||||
"css.escape": "^1.5.1",
|
||||
"date-fns": "^2.16.1",
|
||||
"date-fns-tz": "^1.1.1",
|
||||
|
@ -50,7 +51,6 @@
|
|||
"katex": "^0.12.0",
|
||||
"lodash": "^4.17.19",
|
||||
"mini-css-extract-plugin": "^1.2.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||
"plotly.js": "^1.48.1",
|
||||
"postcss": "^8.0.3",
|
||||
"postcss-calc": "^8.0.0",
|
||||
|
@ -85,11 +85,11 @@
|
|||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.11.3",
|
||||
"@types/clean-css": "^4.2.2",
|
||||
"@types/css-minimizer-webpack-plugin": "^1.1.3",
|
||||
"@types/jquery": "^3.3.31",
|
||||
"@types/mini-css-extract-plugin": "^1.0.0",
|
||||
"@types/node": "^14.0.11",
|
||||
"@types/node-fetch": "^2.5.8",
|
||||
"@types/optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"@types/terser-webpack-plugin": "^4.1.0",
|
||||
"@types/webpack": "^4.4.32",
|
||||
"@types/webpack-dev-server": "^3.1.6",
|
||||
|
|
|
@ -45,4 +45,4 @@ API_FEATURE_LEVEL = 51
|
|||
# historical commits sharing the same major version, in which case a
|
||||
# minor version bump suffices.
|
||||
|
||||
PROVISION_VERSION = "137.0"
|
||||
PROVISION_VERSION = "138.0"
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
import path from "path";
|
||||
|
||||
import CleanCss from "clean-css";
|
||||
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import OptimizeCssAssetsPlugin from "optimize-css-assets-webpack-plugin";
|
||||
import TerserPlugin from "terser-webpack-plugin";
|
||||
import webpack from "webpack";
|
||||
import BundleTracker from "webpack-bundle-tracker";
|
||||
|
@ -187,39 +186,23 @@ export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] =
|
|||
devtool: production ? "source-map" : "cheap-module-source-map",
|
||||
optimization: {
|
||||
minimizer: [
|
||||
// Based on a comment in NMFR/optimize-css-assets-webpack-plugin#10.
|
||||
// Can be simplified when NMFR/optimize-css-assets-webpack-plugin#87
|
||||
// is fixed.
|
||||
new OptimizeCssAssetsPlugin({
|
||||
cssProcessor: {
|
||||
async process(css, options: any) {
|
||||
const filename = path.basename(options.to);
|
||||
const result = await new CleanCss(options).minify({
|
||||
[filename]: {
|
||||
styles: css,
|
||||
sourceMap: options.map.prev,
|
||||
},
|
||||
});
|
||||
for (const warning of result.warnings) {
|
||||
console.warn(warning);
|
||||
}
|
||||
return {
|
||||
css: result.styles + `\n/*# sourceMappingURL=${filename}.map */`,
|
||||
map: result.sourceMap,
|
||||
};
|
||||
},
|
||||
},
|
||||
cssProcessorOptions: {
|
||||
map: {},
|
||||
returnPromise: true,
|
||||
sourceMap: true,
|
||||
sourceMapInlineSources: true,
|
||||
new CssMinimizerPlugin({
|
||||
sourceMap: true,
|
||||
minify: (data: Record<string, string>, sourceMap) => {
|
||||
// css-minimizer-webpack-plugin needs this require
|
||||
// inside the function.
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports, @typescript-eslint/no-var-requires
|
||||
const CleanCSS: typeof import("clean-css") = require("clean-css");
|
||||
const [[filename, styles]] = Object.entries(data);
|
||||
const out = new CleanCSS({sourceMap: true}).minify({
|
||||
[filename]: {styles, sourceMap},
|
||||
});
|
||||
return {css: out.styles, map: out.sourceMap, warnings: out.warnings};
|
||||
},
|
||||
}),
|
||||
new TerserPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: true,
|
||||
}),
|
||||
],
|
||||
splitChunks: {
|
||||
|
|
78
yarn.lock
78
yarn.lock
|
@ -1292,6 +1292,22 @@
|
|||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/css-minimizer-webpack-plugin@^1.1.3":
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-1.1.3.tgz#b6472c27b7d65abe11abe8a0d63b21e3908913ce"
|
||||
integrity sha512-aCF5WzKhuGsYxdDkftkEfngHFUojTbdAurUsIvNQd0bCUvqpGhvK2CwAql3hHeOQjIxUFAv6pTIo3y8dige6Ag==
|
||||
dependencies:
|
||||
"@types/cssnano" "*"
|
||||
"@types/webpack" "^4"
|
||||
postcss "^7.0.32"
|
||||
|
||||
"@types/cssnano@*":
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/cssnano/-/cssnano-4.0.0.tgz#f1bb29d6d0813861a3d87e02946b2988d0110d4e"
|
||||
integrity sha512-BC/2ibKZfPIaBLBNzkitdW1IvvX/LKW6/QXGc4Su/tAJ7mQ3f2CKBuGCCKaqGAnoKwzfuC7G/recpkARwdOwuA==
|
||||
dependencies:
|
||||
postcss "5 - 7"
|
||||
|
||||
"@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.18":
|
||||
version "4.17.18"
|
||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.18.tgz#8371e260f40e0e1ca0c116a9afcd9426fa094c40"
|
||||
|
@ -1423,13 +1439,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
|
||||
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==
|
||||
|
||||
"@types/optimize-css-assets-webpack-plugin@^5.0.1":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.2.tgz#37afc6ca5eecae865551e86d1fd3012aedc40798"
|
||||
integrity sha512-kOeZHQyoeau/6Obelj5/iow7uo5rH2KpbdWPEGCqbC4bxkiteg794tU4LqKFlQKdM5QGCp5Hbapl+zDdQzBNkQ==
|
||||
dependencies:
|
||||
"@types/webpack" "*"
|
||||
|
||||
"@types/parse-json@^4.0.0":
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
|
||||
|
@ -1468,10 +1477,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
|
||||
integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==
|
||||
|
||||
"@types/tapable@*", "@types/tapable@^1.0.5":
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74"
|
||||
integrity sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA==
|
||||
"@types/tapable@^1", "@types/tapable@^1.0.5":
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
||||
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
||||
|
||||
"@types/terser-webpack-plugin@^4.1.0":
|
||||
version "4.2.0"
|
||||
|
@ -1513,14 +1522,14 @@
|
|||
"@types/source-list-map" "*"
|
||||
source-map "^0.7.3"
|
||||
|
||||
"@types/webpack@*", "@types/webpack@^4.4.32", "@types/webpack@^4.41.8":
|
||||
version "4.41.26"
|
||||
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.26.tgz#27a30d7d531e16489f9c7607c747be6bc1a459ef"
|
||||
integrity sha512-7ZyTfxjCRwexh+EJFwRUM+CDB2XvgHl4vfuqf1ZKrgGvcS5BrNvPQqJh3tsZ0P6h6Aa1qClVHaJZszLPzpqHeA==
|
||||
"@types/webpack@*", "@types/webpack@^4", "@types/webpack@^4.4.32", "@types/webpack@^4.41.8":
|
||||
version "4.41.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.27.tgz#f47da488c8037e7f1b2dbf2714fbbacb61ec0ffc"
|
||||
integrity sha512-wK/oi5gcHi72VMTbOaQ70VcDxSQ1uX8S2tukBK9ARuGXrYM/+u4ou73roc7trXDNmCxCoerE8zruQqX/wuHszA==
|
||||
dependencies:
|
||||
"@types/anymatch" "*"
|
||||
"@types/node" "*"
|
||||
"@types/tapable" "*"
|
||||
"@types/tapable" "^1"
|
||||
"@types/uglify-js" "*"
|
||||
"@types/webpack-sources" "*"
|
||||
source-map "^0.6.0"
|
||||
|
@ -3859,6 +3868,21 @@ css-loader@^5.0.0:
|
|||
schema-utils "^3.0.0"
|
||||
semver "^7.3.4"
|
||||
|
||||
css-minimizer-webpack-plugin@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-1.3.0.tgz#d867b4a54ca9920125b30263505e8cca72bc8cf1"
|
||||
integrity sha512-jFa0Siplmfef4ndKglpVaduY47oHQwioAOEGK0f0vAX0s+vc+SmP6cCMoc+8Adau5600RnOEld5VVdC8CQau7w==
|
||||
dependencies:
|
||||
cacache "^15.0.5"
|
||||
cssnano "^4.1.10"
|
||||
find-cache-dir "^3.3.1"
|
||||
jest-worker "^26.3.0"
|
||||
p-limit "^3.0.2"
|
||||
schema-utils "^3.0.0"
|
||||
serialize-javascript "^5.0.1"
|
||||
source-map "^0.6.1"
|
||||
webpack-sources "^1.4.3"
|
||||
|
||||
css-select-base-adapter@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz#3b2ff4972cc362ab88561507a95408a1432135d7"
|
||||
|
@ -7621,7 +7645,7 @@ istanbul-reports@^3.0.2:
|
|||
html-escaper "^2.0.0"
|
||||
istanbul-lib-report "^3.0.0"
|
||||
|
||||
jest-worker@^26.5.0:
|
||||
jest-worker@^26.3.0, jest-worker@^26.5.0:
|
||||
version "26.6.2"
|
||||
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
|
||||
integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==
|
||||
|
@ -7856,14 +7880,6 @@ known-css-properties@^0.21.0:
|
|||
resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.21.0.tgz#15fbd0bbb83447f3ce09d8af247ed47c68ede80d"
|
||||
integrity sha512-sZLUnTqimCkvkgRS+kbPlYW5o8q5w1cu+uIisKpEWkj31I8mx8kNG162DwRav8Zirkva6N5uoFsm9kzK4mUXjw==
|
||||
|
||||
last-call-webpack-plugin@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555"
|
||||
integrity sha512-7KI2l2GIZa9p2spzPIVZBYyNKkN+e/SQPpnjlTiPhdbDW3F86tdKKELxKpzJ5sgU19wQWsACULZmpTPYHeWO5w==
|
||||
dependencies:
|
||||
lodash "^4.17.5"
|
||||
webpack-sources "^1.1.0"
|
||||
|
||||
lazystream@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4"
|
||||
|
@ -8055,7 +8071,7 @@ lodash.uniq@^4.5.0:
|
|||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
||||
|
||||
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.5:
|
||||
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
@ -9237,14 +9253,6 @@ opn@^5.5.0:
|
|||
dependencies:
|
||||
is-wsl "^1.1.0"
|
||||
|
||||
optimize-css-assets-webpack-plugin@^5.0.3:
|
||||
version "5.0.4"
|
||||
resolved "https://registry.yarnpkg.com/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.4.tgz#85883c6528aaa02e30bbad9908c92926bb52dc90"
|
||||
integrity sha512-wqd6FdI2a5/FdoiCNNkEvLeA//lHHfG24Ln2Xm2qqdIk4aOlsR18jwpyOihqQ8849W3qu2DX8fOYxpvTMj+93A==
|
||||
dependencies:
|
||||
cssnano "^4.1.10"
|
||||
last-call-webpack-plugin "^3.0.0"
|
||||
|
||||
optionator@^0.8.1:
|
||||
version "0.8.3"
|
||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495"
|
||||
|
@ -10265,7 +10273,7 @@ postcss-value-parser@^4.0.2, postcss-value-parser@^4.1.0:
|
|||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
|
||||
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==
|
||||
|
||||
postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.35, postcss@^7.0.6:
|
||||
"postcss@5 - 7", postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.35, postcss@^7.0.6:
|
||||
version "7.0.35"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.35.tgz#d2be00b998f7f211d8a276974079f2e92b970e24"
|
||||
integrity sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==
|
||||
|
|
Loading…
Reference in New Issue