Skip to content

Commit

Permalink
fix: Also extract comments for spdx license information
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed May 13, 2024
1 parent a8b6d8e commit 95ae268
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/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
Expand Down

0 comments on commit 95ae268

Please sign in to comment.