This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
60 lines (59 loc) · 1.75 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import {LicenseWebpackPlugin} from "license-webpack-plugin";
import TerserPlugin from 'terser-webpack-plugin'
import satisfies from 'spdx-satisfies';
export default {
entry: './src/index.js',
output: {
filename: 'sdatch.js',
library: {
name: 'sdatch',
type: "umd",
},
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
format: {
comments: (astNode, comment) => (comment.value.startsWith('! licenses are at '))
}
}
}),
]
},
mode: "development",
watchOptions: {
ignored: /(node_modules|.+\.spec\.js$|.+\.html)/
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: {
presets: ['@babel/preset-env']
},
},
exclude: /node_modules/,
}
]
},
plugins: [
new LicenseWebpackPlugin({
licenseInclusionTest: (licenseType) => satisfies(licenseType, '(ISC OR MIT)'),
renderLicenses: (modules) => {
// console.log(modules[0].packageJson, modules[0].licenseId, modules[0].licenseText);
return JSON.stringify(modules);
},
outputFilename: 'sdatch.licenses.txt',
addBanner: true,
renderBanner: (filename, modules) => {
console.log(modules);
return '/*! licenses for dependencies are at ' + filename + '*/';
},
})
]
};