React is distributed under BSD style license. How to satisfy this requirement when I minify resulting JS file? I.e. many libraries have licensing headers which include special metadata but not React.
I use webpack with uglifyjs for minification. Uglifyjs has an option to preserve comments but it includes everything. There's also a plugin for uglify but I wasn't able to integrate it with webpack.
The licenses of packages listed in the dependencies of your package. json are included by default in the build via the comments option. (It looks like this may be changing for webpack v4.) Note that licenses of dependencies listed in the devDependencies are not included in the built file.
BSD licenses are a low restriction type of license for open source software that does not put requirements on redistribution.
I found an answer myself. I used this project for it https://github.com/shinnn/uglify-save-license
Just add the following to webpack.config.js:
const saveLicense = require('uglify-save-license');
...
plugins: [
new webpack.optimize.UglifyJsPlugin({
output: {
comments: saveLicense
}
}),
...
]
Copyright headers are included many times, but it's not that a big deal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With