88. Use the Excludechunks item in Htmlwebpackplugin, modify the Webpack.config.js file, modify the contents as follows
var webpack = require (' Webpack '); var htmlwebpackplugin = require (' Html-webpack-plugin '); module.exports = {entry:{' Greeter ': __dirname + "/app/greeter.js", ' a ': __dirname + "/app/a.js", ' B ': __dirname + "/app/b.js", ' C ': __dirname + "/app/ C.js "},output: {path: __dirname +"/build ", FileName:" [name]-[chunkhash].js "},devserver:{contentbase:"./public ", Historyapifallback:true,inline:true},module:{loaders:[{test:/\.json$/,loader: "Json-loader"},{test:/\.js$/, Exclude:/node_modules/,loader: ' Babel-loader '},{test:/\.css$/,loader: ' Style-loader!css-loader?modules '}], Plugins:[new Webpack. Bannerplugin ("Copyright Suyan"), new Htmlwebpackplugin ({template:__dirname + "/app/index.tmpl.html", Title: ' Htmlwebpackplugin filename Test ', filename: ' filename.html ', inject: ' Body ', excludechunks:[' a ']//chunks:[' a ', ' C ']}] }
89. Repackaging with the Webpack command
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8D/C3/wKioL1iqiTWBtHwgAABdrqYmy8I806.png-wh_500x0-wm_ 3-wmp_4-s_4207210641.png "title=" 89.png "alt=" Wkiol1iqitwbthwgaabdrqymy8i806.png-wh_50 "/>
90. View what the generated filename.html file generates
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8D/C3/wKioL1iqiXGC_vZSAACw-T0by5I120.png-wh_500x0-wm_ 3-wmp_4-s_638578916.png "title=" 90.png "alt=" Wkiol1iqixgc_vzsaacw-t0by5i120.png-wh_50 "/>
Description
When we configure excludechunks:[' a ' in the Webpack.config.js file, the generated file does not contain a-xxxx.js references, while the other JS files will be referenced in the build file
This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1899454
Webpack Getting Started Tutorial 17