首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

BannerPlugin

在每个生成的块的顶部添加一个横幅。

代码语言:javascript
复制
new webpack.BannerPlugin(banner)
// or
new webpack.BannerPlugin(options)

选项

代码语言:javascript
复制
{
  banner: string, // the banner as string, it will be wrapped in a comment
  raw: boolean, // if true, banner will not be wrapped in a comment
  entryOnly: boolean, // if true, the banner will only be added to the entry chunks
  test: string | RegExp | Array,
  include: string | RegExp | Array,
  exclude: string | RegExp | Array,
}

占位符

从 webpack 2.5.0 开始,会对 banner 字符串中的占位符取值:

代码语言:javascript
复制
new webpack.BannerPlugin({
  banner: "hash:[hash], chunkhash:[chunkhash], name:[name], filebase:[filebase], query:[query], file:[file]"
})

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com