File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838- v4.0.1 Support webpack4.x
3939- v4.0.2 Fix duplicate resource in watch mode
4040- v4.0.3 fix external favico issue
41+ - v4.0.4 fix favico not exist error
4142
4243## 中文
4344- v0.0.1 html生成及相关js,css资源内联
7778- v3.2.6 若注入资源中,如果没有引入资源,会让程序继续运行
7879- v4.0.1 支持 webpack4.x
7980- v4.0.2 修复 watch 模式下资源重复的问题
80- - v4.0.3 修复外链 favico 的问题
81+ - v4.0.3 修复外链 favico 的问题
82+ - v4.0.4 修复 favico 文件不存在报错
Original file line number Diff line number Diff line change @@ -188,12 +188,18 @@ HtmlResWebpackPlugin.prototype.apply = function(compiler) {
188188 ) ;
189189
190190 // inject favicon
191- if ( this . options . favicon ) {
192- this . options . faviconFileName = this . addFileToWebpackAsset (
193- compilation ,
194- this . options . favicon ,
195- utils . getBaseName ( this . options . favicon , null )
196- ) ;
191+ let favicon = this . options . favicon ;
192+ if ( favicon ) {
193+ if ( ! fs . existsSync ( favicon ) ) {
194+ utils . alert ( `Favicon file does not exist: ${ this . options . favicon } ` , 1 ) ;
195+ }
196+ else {
197+ this . options . faviconFileName = this . addFileToWebpackAsset (
198+ compilation ,
199+ favicon ,
200+ utils . getBaseName ( favicon , null )
201+ ) ;
202+ }
197203 }
198204
199205 // webpack options
Original file line number Diff line number Diff line change 11{
22 "name" : " html-res-webpack-plugin" ,
3- "version" : " 4.0.3 " ,
3+ "version" : " 4.0.4 " ,
44 "description" : " html generation and resource inline or md5 for webpack" ,
55 "keywords" : [
66 " front-end" ,
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ var webpackConfig = [
3030 require ( basePath + "/resource-favico/webpack.config.js" ) , // generate favicon
3131 require ( basePath + "/resource-favico-1/webpack.config.js" ) , // html mode generate favicon
3232 require ( basePath + "/resource-favico-2/webpack.config.js" ) , // html mode external favicon
33+ require ( basePath + "/resource-favico-3/webpack.config.js" ) , // no favicon file but fill in the option
3334 require ( basePath + "/resource-common-1/webpack.config.js" ) , // common chunk generated by webpack
3435 require ( basePath + "/resource-common-2/webpack.config.js" ) , // html mode common chunk generated by webpack
3536 require ( basePath + "/resource-copy-plugin-1/webpack.config.js" ) , // usage with copy-webpack-plugin-hash
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html lang ="zh ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < title > Tencent QQ</ title >
6+ < link rel ="shortcut icon " type ="image/x-icon " href ="//im.qq.com/favicon.ico ">
7+ < link rel ="icon " type ="image/x-icon " href ="//im.qq.com/favicon.ico ">
8+ < script src ="//localhost:9000/[libs/react.js] "> </ script >
9+ < link rel ="stylesheet " href ="//localhost:9000/[js/index.css] ">
10+ </ head >
11+ < body >
12+ < div id ="pages " class ="qq-ui "> </ div >
13+
14+
15+
16+ < script src ="//localhost:9000/[js/index.js] "> </ script >
17+ </ body >
18+ </ html >
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html lang ="zh ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < title > Tencent QQ</ title >
6+ < link rel ="shortcut icon " type ="image/x-icon " href ="//im.qq.com/favicon.ico ">
7+ < link rel ="icon " type ="image/x-icon " href ="//im.qq.com/favicon.ico ">
8+ < script src ="libs/react.js "> </ script >
9+ < link rel ="stylesheet " href ="js/index.css ">
10+ </ head >
11+ < body >
12+ < div id ="pages " class ="qq-ui "> </ div >
13+
14+
15+
16+ < script src ="js/index.js "> </ script >
17+ </ body >
18+ </ html >
Original file line number Diff line number Diff line change 1+
2+ require ( './index.less' ) ;
3+
4+ var a = "hello world!" ;
Original file line number Diff line number Diff line change 1+ html , body {
2+ margin : 0 ;
3+ padding : 0 ;
4+ }
5+
6+ .img {
7+ background- url: url(" ./logo.png" ) ;
8+ }
Original file line number Diff line number Diff line change 1+ var react = {
2+ reactDom : function ( ) {
3+
4+ }
5+ } ;
You can’t perform that action at this time.
0 commit comments