且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Webpack入门教程二十四

更新时间:2022-10-04 13:21:04

116.输出HtmlWebpackPlugin.files中的内容,修改模板文件index.html,代码如下

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>webpack demo</title>
	<link rel="stylesheet" href="">
</head>
<body>
	<% for (var key in htmlWebpackPlugin.files) {%>
		<%= key %> : <%= JSON.stringify(htmlWebpackPlugin.files[key]) %>
	<% } %>
</body>
</html>

117.使用cnpm run webpack命令重新打包

Webpack入门教程二十四

118.查看生成的index-9b7e6d15108bc45c5cbd.html文件输出的内容

Webpack入门教程二十四



本文转自 素颜猪 51CTO博客,原文链接:http://blog.51cto.com/suyanzhu/1899525