在线文档教程

BannerPlugin

BannerPlugin

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

new webpack.BannerPlugin(banner) // or new webpack.BannerPlugin(options)

选项

{ 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 字符串中的占位符取值:

new webpack.BannerPlugin{ banner: "hash:[hash], chunkhash:[chunkhash], name:[name], filebase:[filebase], query:[query], file:[file]" })