3.0.0 • Published 4 years ago

license-info-webpack-plugin v3.0.0

Weekly downloads
661
License
MIT
Repository
github
Last release
4 years ago

license-info-webpack-plugin

npm version npm.io

license-info-webpack-plugin is a webpack plugin for making a list of package's LICENSE information, inspired by licensify.

$ npm install --save-dev license-info-webpack-plugin
$ yarn add --dev license-info-webpack-plugin

Usage

webpack v4

If you use webpack < 4.2 that has dependency on uglifyjs-webpack-plugin < 1.2.4, you need to set optimization to set uglifyOptions.

const path = require('path');
const LicenseInfoWebpackPlugin = require('license-info-webpack-plugin').default;
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");

module.exports = {
  mode: 'production',
  entry: './src/js/index.js',
  output: {
    path: path.join(__dirname, 'dist/js'),
    filename: '[name].js'
  },
  plugins: [
    new LicenseInfoWebpackPlugin({
      glob: '{LICENSE,license,License}*'
    })
  ]
};

webpack v3

const path = require('path');
const LicenseInfoWebpackPlugin = require('license-info-webpack-plugin').default;
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");

module.exports = {
  entry: './src/js/index.js',
  output: {
    path: path.join(__dirname, 'dist/js'),
    filename: '[name].js'
  },
  plugins: [
    new LicenseInfoWebpackPlugin({
      glob: '{LICENSE,license,License}*'
    }),
    new UglifyJsPlugin({
      uglifyOptions: {
        output: {
          comments: /^\**!|@preserve|@license|@cc_on/
        }
      }
    })
  ]
};

Note

If you use uglifyjs-webpack-plugin@^1.2.4 or webpack has dependency on uglifyjs-webpack-plugin@^1.2.4, you don't need to set uglifyOptions for preserve license comments.
Related: https://github.com/webpack-contrib/uglifyjs-webpack-plugin/pull/250

If you use uglifyjs-webpack-plugin@~1.1, you need to set uglifyOptions for preserve license comments.
Related: https://github.com/webpack-contrib/uglifyjs-webpack-plugin/pull/174

license-info-webpack-plugin needs webpack v3.0 or above

Options

  • glob
    • Glob pattern for LICENSE file
    • Default: '{LICENSE,license,License}*'
  • outputType
    • Output type: 'banner' or 'html'
      • 'banner': Append comment to top of bundled code
      • 'html': Generate html (e.g. license.[name].html)
    • Default: 'banner'
  • includeLicenseFile
    • Include and put LICENSE file
    • Default: true

LICENSE

MIT

3.0.0

4 years ago

3.0.0-beta.1

4 years ago

3.0.0-beta.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

5 years ago

2.0.0-alpha

5 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago