webpack命令行参数
|
|
山峰永不相遇,而人人却处处相逢。
|
|
extract-text-webpack-plugin (提取样式插件)
把额外的数据(CSS代码)加到编译好的文件中
|
|
|
|
|
|
|
|
这样执行webpack命令后,生成的2个目标文件(index-build.html,login-build.html),有什么问题呢?
2个文件都引入了所有的js和css。
下面我们要做到按需引用,不同的html模板引入仅它自己需要的css和js
为index.html新建一个index.css:
|
|
为index.html新建index.js,并在其中引入index.css:
|
|
编辑webpack.config.js,为不同的html模板指定不同的配置节点
|
|
执行webpack之后
查看index-build.html中只引入了index.css和index.js
WebpackPluginGraphqlSchemaHot ()
This plugin tracks changes in your GraphQL Schema and generates its introspection in json and txt formats.
|
|
|
FaviconsWebpackPlugin ()
Automatically generates over 30 favicons (configurable) for Android, iOS, and the different desktop browsers from one source png. Integrates well with the html-webpack-plugin.
|
|
|
WebpackShellPlugin ()
Fires shell commands before and after webpack builds. Great for reporting tools, testing, or opening your browser for development.
|
|
|