microsoft / license-checker-webpack-plugin

Webpack plugin that verifies licenses of all external dependencies in a compilation, and outputs them to a file.
MIT License
135 stars 28 forks source link

Respect manually added dependencies #31

Open MikeDevice opened 3 years ago

MikeDevice commented 3 years ago

There are some dependencies that are installed into projects, but aren't imported from the source code. They are included to the projects in different ways. These are some examples:

Such dependencies don't get into the ThirdPartyNotices file because they are not imported.

I have an idea to specify manually such dependencies in webpack config like so:

const LicenseCheckerWebpackPlugin = require("license-checker-webpack-plugin");

module.exports = {
  plugins: [
    new LicenseCheckerWebpackPlugin({
      manuallyInstalledDependencies: [
        path.resolve(__dirname, "node_modules", 'focus-visible'),
        path.resolve(__dirname, "node_modules", 'awsm.css'),
        path.resolve(__dirname, "node_modules", 'github-corners'),
      ]
    })
  ]
};
silverwind commented 3 years ago

I also have this requirement for icons that are never imported but still used (pulled directly out of node_modules). I'd suggest just calling it additionalModules like this plugin does.