Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
license-webpack-plugin
Advanced tools
Package description
The license-webpack-plugin is a plugin for Webpack that helps you to manage and automate the process of handling license information for the packages included in your bundle. It can generate a license file, include license texts in your bundle, and filter packages based on their licenses.
Generate a license file
This feature allows you to generate a single file that contains all the license information for the packages included in your webpack bundle. The 'outputFilename' option specifies the name of the file to be created.
new LicenseWebpackPlugin({
outputFilename: 'licenses.txt'
})
Include license texts in the bundle
With this feature, you can include the license texts directly in your webpack bundle. Setting 'perChunkOutput' to false will include all licenses in the main bundle file instead of separate chunk files.
new LicenseWebpackPlugin({
perChunkOutput: false
})
Filter packages by license type
This feature allows you to filter which packages to include based on their license type. In this example, only packages with the 'MIT' license will be included.
new LicenseWebpackPlugin({
licenseInclusionTest: (licenseType) => licenseType === 'MIT'
})
Similar to license-webpack-plugin, webpack-license-plugin also helps in managing licenses for third-party dependencies. It can generate a third-party notices file including all licenses. It differs in the way it handles the output and configuration options.
This plugin is another alternative that scans your node_modules directory to check for licenses and outputs a summary of the license information. It is less focused on bundling the licenses with the webpack output and more on reporting and compliance.
Readme
Manage third-party license compliance in your webpack build.
npm install license-webpack-plugin --save-dev
To use the plugin, simply add it to the plugins section in the webpack config.
Example:
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
module.exports = {
plugins: [
new LicenseWebpackPlugin()
]
};
The default behavior will add a license notice file to each chunk of the webpack build. In addition, it will add a banner indicating the path to the license notice file in any Javascript assets. Third party libraries imported via external tools like SASS @import
may not appear in the output (since webpack does not process @import
). If this issue happens, please specify additional modules that the plugin should scan.
To configure the plugin, check the documentation.
yarn
yarn build
Migration guides for breaking changes are documented here.
The changelog can be found here.
FAQs
Outputs licenses from 3rd party libraries to a file
The npm package license-webpack-plugin receives a total of 2,590,888 weekly downloads. As such, license-webpack-plugin popularity was classified as popular.
We found that license-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.