Add license and copy it into bundle while making terser ignore the SDK

This commit is contained in:
Johannes Marbach 2023-11-22 21:04:39 +01:00
parent 27bba26856
commit d3ef8ff658
2 changed files with 231 additions and 1 deletions

View file

@ -198,7 +198,17 @@ module.exports = (env, argv) => {
// Minification is normally enabled by default for webpack in production mode, but
// we use a CSS optimizer too and need to manage it ourselves.
minimize: enableMinification,
minimizer: enableMinification ? [new TerserPlugin({}), new CssMinimizerPlugin()] : [],
minimizer: enableMinification
? [
new TerserPlugin({
// Already minified and includes an auto-generated license comment
// that the plugin would otherwise pointlessly extract into a separate
// file. We add the actual license using CopyWebpackPlugin below.
exclude: "jitsi_external_api.min.js",
}),
new CssMinimizerPlugin(),
]
: [],
// Set the value of `process.env.NODE_ENV` for libraries like React
// See also https://v4.webpack.js.org/configuration/optimization/#optimizationnodeenv
@ -715,6 +725,7 @@ module.exports = (env, argv) => {
patterns: [
"res/apple-app-site-association",
"res/jitsi_external_api.min.js",
"res/jitsi_external_api.min.js.LICENSE.txt",
"res/manifest.json",
"res/sw.js",
"res/welcome.html",