Skip to content

Commit

Permalink
update terser-webpack-plugin
Browse files Browse the repository at this point in the history
Terser now produces LICENSE.js.txt.gz file
  • Loading branch information
KKoukiou committed Jun 8, 2021
1 parent 678644e commit e683937
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cockpit-certificates.spec.in
Expand Up @@ -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/*

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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"
},
Expand Down
13 changes: 12 additions & 1 deletion webpack.config.js
Expand Up @@ -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: {
Expand Down

0 comments on commit e683937

Please sign in to comment.