Update terser-webpack-plugin

Following our other projects.
This commit is contained in:
Martin Pitt 2021-07-23 07:39:58 +02:00 committed by Katerina Koukiou
parent 28466f7217
commit a509dde986
4 changed files with 15 additions and 4 deletions

View file

@ -28,7 +28,7 @@ find %{buildroot}%{_datadir}/cockpit/ -name '*.map' | xargs --no-run-if-empty rm
%files %files
%doc README.md %doc README.md
%license LICENSE dist/index.js.LICENSE.txt %license LICENSE dist/index.js.LICENSE.txt.gz
%{_datadir}/cockpit/* %{_datadir}/cockpit/*
%{_datadir}/metainfo/* %{_datadir}/metainfo/*

View file

@ -43,7 +43,7 @@
"sizzle": "^2.3.3", "sizzle": "^2.3.3",
"stdio": "^2.1.0", "stdio": "^2.1.0",
"string-replace-loader": "^3.0.0", "string-replace-loader": "^3.0.0",
"terser-webpack-plugin": "^2.0.1", "terser-webpack-plugin": "^5.1.4",
"webpack": "^5.31.0", "webpack": "^5.31.0",
"webpack-cli": "^4.6.0" "webpack-cli": "^4.6.0"
}, },

View file

@ -12,7 +12,7 @@ actions:
create-archive: create-archive:
- make NODE_ENV=development NODE_OPTIONS=--max-old-space-size=500 - make NODE_ENV=development NODE_OPTIONS=--max-old-space-size=500
# dummy LICENSE.txt, as terser did not run # dummy LICENSE.txt, as terser did not run
- touch dist/index.js.LICENSE.txt - touch dist/index.js.LICENSE.txt.gz
- make dist-gzip - make dist-gzip
# starter-kit.git has no release tags; your project can drop this once you have a release # starter-kit.git has no release tags; your project can drop this once you have a release
get-current-version: make print-version get-current-version: make print-version

View file

@ -58,7 +58,18 @@ module.exports = {
optimization: { optimization: {
minimize: production, 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: { module: {