forked from SAP/karma-ui5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
38 lines (37 loc) · 996 Bytes
/
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
const path = require("path");
const LicenseWebpackPlugin = require("license-webpack-plugin").LicenseWebpackPlugin;
const allowedLicenses = [
"MIT",
"BSD-3-Clause"
];
module.exports = {
mode: "production",
entry: {
"browser-bundle": "./lib/client/browser.js"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "browser-bundle.js"
},
plugins: [
new LicenseWebpackPlugin({
addBanner: true,
unacceptableLicenseTest: (licenseType) => {
// Fail when not allowed licenses would be packaged
return !allowedLicenses.includes(licenseType);
},
renderLicenses: (modules) => {
const line = (v) => v ? `\n${v}` : "";
return modules
.sort((a, b) => a.name < b.name ? -1 : 1)
.map((module) => {
let text = `${module.name} (${module.packageJson.version})`;
text += line(module.packageJson.homepage);
text += line(module.licenseId);
text += line(module.licenseText);
return text;
}).join("\n\n");
}
})
]
};