126. Use the same template file to generate different files and different titles, modify the Webpack.config.js file, the code is as follows
var htmlwebpackplugin = require ("Html-webpack-plugin"); module.exports = {entry:{main: './src/script/main.js ', A: './ Src/script/a.js '},output:{path: './dist ', filename: ' js/[name]-[hash].js ',},plugins:[new htmlwebpackplugin ({ Template: ' index.html ', filename: ' a.html ', Inject:false,title: ' This is a.html '}, new Htmlwebpackplugin ({Template: ' Index.html ', filename: ' b.html ', Inject:false,title: ' This is b.html '}, new Htmlwebpackplugin ({Template: ' index.html ', FileName: ' c.html ', Inject:false,title: ' This is c.html '}]}
127. Modify the template file index.html, the code is as follows
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8D/C8/wKioL1iqvNODYdFZAABxVFEJ41c414.png-wh_500x0-wm_ 3-wmp_4-s_51455211.png "title=" Qq20170220175343.png "alt=" Wkiol1iqvnodydfzaabxvfej41c414.png-wh_50 "/>
128. RePack with the CNPM run Webpack command
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/CA/wKiom1iqvQfzEO7QAACPGFbOPD4520.png-wh_500x0-wm_ 3-wmp_4-s_171669827.png "title=" Qq20170220175443.png "alt=" Wkiom1iqvqfzeo7qaacpgfbopd4520.png-wh_50 "/>
129. View the generated a.html,b.html,c.html file
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/8D/C8/wKioL1iqvVPwWI8dAABkXSoRC8E071.png-wh_500x0-wm_ 3-wmp_4-s_1285424707.png "title=" Qq20170220175557.png "alt=" Wkiol1iqvvpwwi8daabkxsorc8e071.png-wh_50 "/>
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8D/C8/wKioL1iqvWiB5D26AABnMv4XxKI850.png-wh_500x0-wm_ 3-wmp_4-s_2305478615.png "title=" Qq20170220175619.png "alt=" Wkiol1iqvwib5d26aabnmv4xxki850.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8D/C8/wKioL1iqvYGBLPxKAABnuSk-gXU345.png-wh_500x0-wm_ 3-wmp_4-s_3908889466.png "title=" Qq20170220175644.png "alt=" Wkiol1iqvygblpxkaabnusk-gxu345.png-wh_50 "/>
This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1899587
Webpack Getting Started Tutorial 27