版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hjh15827475896/article/details/86300056
webpack 自动生成 html,需要借助插件 HtmlWebpackPlugin
方法
安装 html-webpack-plugin
npm install html-webpack-plugin --save-dev
let htmlwebpackplugin = require("html-webpack-plugin");
module.export = {
.......
plugins:[
new htmlwebpackplugin({
title:"页面标题",
template:'./index.html', // 模板文件的路径
filename:'index.html', //生成的文件的名称
showErrors:true,
inject:true //是否将生成的css,js文件,自动插入生成的html中
}),
]
}
参考页面
http://www.cnblogs.com/wonyun/p/6030090.html
htmlwebpackplugin的详细解说