html-webpack-plugin的两个基本作用
1.自动在内存中根据指定页面生成一个内存的HTML页面
2.把打包好的bundle.js追加到页面中
安装步骤:
1. 在webpack.config.js开头导入html-webpack-plugin
const htmlWebpackPlugin = require('html-webpack-plugin')
2.在plugins中new htmlWebpackPlugin()
plugins:[ //配置插件的节点
new htmlWebpackPlugin({ //创建一个在内存中生成 HTML 的插件
template: path.join(__dirname,'./src/index.html'), //指定在内存中生成的模板页面
filename:'index.html' //指定内存中的页面名称
}),
]