@gluons/vue-pack-banner-plugin
Version:
A vue-pack plugin to add banner to generated bundles.
25 lines (24 loc) • 705 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const webpack_1 = require("webpack");
/**
* A `vue-pack` plugin to add banner to bundle via `webpack.BannerPlugin`.
*
* @export
* @param {string} banner Banner
* @returns {Plugin}
*/
function BannerPlugin(banner) {
return (context) => {
if (!banner) {
return;
}
const { webpackConfigs } = context;
Object.keys(webpackConfigs).forEach(key => {
const config = webpackConfigs[key];
config.plugin('banner').use(webpack_1.BannerPlugin, [banner]);
});
};
}
exports.default = BannerPlugin;
module.exports = BannerPlugin;