This is a smart banner webpack plugin which has the same function and usage as webpack.BannerPlugin and supports [filename] syntax in banner string
Note: This is a clone of webpack.BannerPlugin with the only difference that it supports variable [filename] in banner string which will be replaced by the chunk filename
The use of smart-banner-webpack-plugin 2.0.0 and 3.0.0 has a little difference which is illustrated in the following examples.
// webpack 1
import SmartBannerPlugin from 'smart-banner-webpack-plugin';
// part of webpack.config.js
{
...
plugins: [
new SmartBannerPlugin(
`[filename] v1.0.0\n\nAuthor: johvin\nDate: ${new Date().toLocaleString()}\n`,
{ raw: false, entryOnly: true })
],
...
}
// webpack 2
import SmartBannerPlugin from 'smart-banner-webpack-plugin';
// part of webpack.config.js
{
...
plugins: [
new SmartBannerPlugin({
banner: `[filename] v1.0.0\n\nAuthor: johvin\nDate: ${new Date().toLocaleString()}\n`,
raw: false,
entryOnly: true
})
],
...
}
[filename] is replaced by the chunk filename in the process of compilation, e.g. the code below is a processed banner
/*!
* server.js v1.0.0
*
* Author: johvin
* Date: 2016-08-04 09:37:05
*
*/