Webpack Getting Started Tutorial 17

Source: Internet
Author: User

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 "/>

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

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.