From e683937d6d64ef9a92454a07d7815e8d5e0ccec0 Mon Sep 17 00:00:00 2001 From: Katerina Koukiou Date: Tue, 8 Jun 2021 13:23:37 +0200 Subject: [PATCH] update terser-webpack-plugin Terser now produces LICENSE.js.txt.gz file --- cockpit-certificates.spec.in | 2 +- package.json | 2 +- webpack.config.js | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cockpit-certificates.spec.in b/cockpit-certificates.spec.in index 6425df2a..cc8c4bc4 100644 --- a/cockpit-certificates.spec.in +++ b/cockpit-certificates.spec.in @@ -29,7 +29,7 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/* %files %doc README.md -%license LICENSE dist/index.js.LICENSE.txt +%license LICENSE dist/index.js.LICENSE.txt.gz %{_datadir}/cockpit/* %{_datadir}/metainfo/* diff --git a/package.json b/package.json index c5b91488..a069faed 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "stdio": "^0.2.7", "string-replace-loader": "^3.0.0", "svgo": "1.3.0", - "terser-webpack-plugin": "^2.0.1", + "terser-webpack-plugin": "^5.1.3", "webpack": "^5.31.0", "webpack-cli": "^4.6.0" }, diff --git a/webpack.config.js b/webpack.config.js index c5c589d2..0394be30 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -79,7 +79,18 @@ module.exports = { optimization: { minimize: production, - minimizer: [new TerserJSPlugin(), new CssMinimizerPlugin()], + minimizer: [ + new TerserJSPlugin({ + extractComments: { + condition: true, + filename: `[file].LICENSE.txt?query=[query]&filebase=[base]`, + banner(licenseFile) { + return `License information can be found in ${licenseFile}`; + }, + }, + }), + new CssMinimizerPlugin() + ], }, module: {