Browse Source
fix: Also extract comments for `spdx` license information
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/45252/head
Ferdinand Thiessen
2 years ago
committed by
Andy Scherzinger
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
1 changed files with
20 additions and
0 deletions
-
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
|
|
|
|
|