diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-13 09:48:54 +0200 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2024-05-13 17:41:37 +0200 |
commit | 36b6af9259a50d967075870482efa0917ea5f98f (patch) | |
tree | b02f38720c915cac05968806911083ed700fbc7c /webpack.common.js | |
parent | 1f7e2ba599b147fcb587644cd6dc84807a9abad9 (diff) | |
download | nextcloud-server-36b6af9259a50d967075870482efa0917ea5f98f.tar.gz nextcloud-server-36b6af9259a50d967075870482efa0917ea5f98f.zip |
fix: Also extract comments for `spdx` license information
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'webpack.common.js')
-rw-r--r-- | webpack.common.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/webpack.common.js b/webpack.common.js index d84979f74cd..aa937719f24 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -147,6 +147,26 @@ module.exports = { }, optimization: { + minimizer: [{ + apply: (compiler) => { + // Lazy load the Terser plugin + const TerserPlugin = require('terser-webpack-plugin') + new TerserPlugin({ + extractComments: { + condition: /^\**!|@license|@copyright|SPDX-License-Identifier|SPDX-FileCopyrightText/i, + filename: (fileData) => { + // The "fileData" argument contains object with "filename", "basename", "query" and "hash" + return `${fileData.filename}.license${fileData.query}` + }, + }, + terserOptions: { + compress: { + passes: 2, + }, + }, + }).apply(compiler) + }, + }], splitChunks: { automaticNameDelimiter: '-', minChunks: 3, // minimum number of chunks that must share the module |