- 0133技术站
- 联系QQ:18840023
- QQ交流群

- 微信公众号

为每个 chunk 文件头部添加 banner。
new webpack.BannerPlugin(banner) // or new webpack.BannerPlugin(options)
{ banner: string, // 其值为字符串,将作为注释存在 raw: boolean, // 如果值为 true,将直出,不会被作为注释 entryOnly: boolean, // 如果值为 true,将只在入口 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]" })
推荐手册