Add raw banner into entry at final step.
install module:
npm i webpack-final-banner-plugin
use in webpack.config.js:
const FinalBannerPlugin = require('./webpack-final-banner-plugin');
const bannerOption = {
banner:'your custom banner or some executeable code'
}
// add in plugins
...
plugins: [
new FinalBannerPlugin(bannerOption)
],
...
The default banner plugin can't add double slash comments like '// some comment'
,as result it returns:
/*
*
* // some comment
*
*/
it can't be use in some scipt metadata such as Greasemonkey.but this plugin can done with double-slash.