html-webpack-plugin

Introduction:

The HtmlWebpackPlugin simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply your own template using lodash templates, or use your own loader.

译文:HtmlWebpackPlugin简化了HTML文件的创建,为您的webpack包服务。这对于在文件名中包含散列的webpack包尤其有用,它会更改每次编译。您可以让插件为您生成一个HTML文件,使用lodash模板提供您自己的模板,或者使用您自己的加载程序。

权威讲解请移步: https://webpack.js.org/plugins/html-webpack-plugin/  or  https://github.com/jantimon/html-webpack-plugin

Installation:

npm install --save-dev html-webpack-plugin or npm i -D html-webpack-plugin

Usage:

const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
entry: 'index.js',
output: {
filename: 'index_bundle.js',
path: __dirname + '/dist'
},
plugins: [new HtmlWebpackPlugin()]
}

这个插件有很多可配置参数:

plugins: [
new HtmlWebpackPlugin({
title: 'Output Management',
filename: 'index-bundle.html' /*----可以配置最终生成的文件名称---*/
template: './src/index.html' /*----可以配置初始模板---*/
})
],

更多配置请移步:https://github.com/jantimon/html-webpack-plugin#options

clean-webpacm-plugin  的作用是 Cleaning up the /dist folder  清除的目录可以名称可以配置

npm install --save-dev clean-webpack-plugin
const { CleanWebpackPlugin } = require('clean-webpack-plugin')

plugins: [new CleanWebpackPlugin()]

最新文章

  1. ZOJ Problem Set - 1045 HangOver
  2. Mac下JDK安装配置
  3. Python的包管理工具--PIP安装使用
  4. 开源app之MyHearts
  5. apache开源项目-- OODT
  6. Binary Search Tree Iterator 解答
  7. UVA11080- Place the Guards(二分图染色)
  8. CentOS 7中将Tomcat设置为系统服务
  9. 官方windows10升级工具
  10. 好用的前端页面性能检测工具—sitespeed.io
  11. Xcode7.3.1中通过最新的CocoaPod安装pop动画引擎
  12. 轻松学习UML之用例图,时序图
  13. Python函数声明以及与其他编程语言数据类型的比较
  14. Qt5.7.0移植到4412
  15. go语言变量
  16. 深入理解HashMap和CurrentHashMap
  17. Linux服务器GlashFish的Domain管理
  18. Hash算法和一致性Hash算法
  19. effective java——31用实例域代替序数
  20. sql server 小技巧(8) visual studio 2013里使用Sql server compact 4.0及发布问题处理

热门文章

  1. java web编写四则运算
  2. cas的单点登录实现
  3. LVS+Keepalived -----> 效率最高的负载均衡器
  4. 页面弹窗toast和加载loading
  5. 10.Redis的RDB和AOF两种持久化机制的优劣势对比
  6. C:数值溢出问题
  7. 【代码总结】PHP之会话跟踪技术
  8. PTA的Python练习题(十二)-第4章-7 统计学生平均成绩与及格人数
  9. ElasticSearch学习记录 - 命令示例
  10. nodejs下载