Webpack Getting Started Tutorial 16

Source: Internet
Author: User

84.HtmlWebpackPlugin chunks Configuration, the Webpack.config.js file is modified 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 ', chunks:[' a ', ' C ']}]}
85. Create the A.js,b.js,c.js file in the app directory
CD Appdirecho function A () {} > A.jsdirmore A.jsecho function B () {} > B.jsdirmore B.jsecho function C () {} > C.js

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8D/C5/wKiom1iqhdfyNlPLAABIrPYtbFc945.png-wh_500x0-wm_ 3-wmp_4-s_4112104418.png "title=" 85-1.png "alt=" Wkiom1iqhdfynlplaabirpytbfc945.png-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/C5/wKiom1iqhh2gJH-9AAAoPDDUf-4250.png-wh_500x0-wm_ 3-wmp_4-s_3428723166.png "title=" 85-2.png "alt=" Wkiom1iqhh2gjh-9aaaopdduf-4250.png-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8D/C5/wKiom1iqhmOACKkkAAAqufVl_bs467.png-wh_500x0-wm_ 3-wmp_4-s_792254613.png "title=" 85-3.png "alt=" Wkiom1iqhmoackkkaaaqufvl_bs467.png-wh_50 "/>

86. RePack with Webpack

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/8D/C2/wKioL1iqhvPRjxpaAABetWuonOQ495.png-wh_500x0-wm_ 3-wmp_4-s_3224459539.png "title=" 86.png "alt=" Wkiol1iqhvprjxpaaabetwuonoq495.png-wh_50 "/>

87. View the project directory structure and the generated filename.html file

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8D/C3/wKioL1iqhzDQL0T2AAA33r2fcns014.png-wh_500x0-wm_ 3-wmp_4-s_2337746981.png "title=" 87.png "alt=" Wkiol1iqhzdql0t2aaa33r2fcns014.png-wh_50 "/>

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/C3/wKioL1iqh2yy5xZiAACpDjqV-sw688.png-wh_500x0-wm_ 3-wmp_4-s_2134349540.png "title=" 87-2.png "alt=" Wkiol1iqh2yy5xziaacpdjqv-sw688.png-wh_50 "/>

Description
Chunks configuration, add the required A and C files to the template, then the B file will not be referenced in filename


This article is from the "Yan" blog, please be sure to keep this source http://suyanzhu.blog.51cto.com/8050189/1899449

Webpack Getting Started Tutorial 16

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.