chemdemo/webpack-seed

执行npm run build报错

Closed this issue · 3 comments

您好,我clone了您的项目安装了node modules之后,执行指令npm run build报错,在最后

如果把gulpfile.js里的htmlminifier的内容注释掉就正常运行了。。。而且html也是压缩的

liupy525»~/Desktop/webpack-seed:master✘:✹⚡ npm run build

> webpack-seed@0.1.0 build /Users/liupy525/Desktop/webpack-seed
> gulp

[21:02:56] Using gulpfile ~/Desktop/webpack-seed/gulpfile.js
[21:02:56] Starting 'hint'...

src/js/b.js
  line 18  col 1  'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
  line 20  col 1  'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
  line 21  col 1  'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

  ⚠  3 warnings


src/js/helpers/ajax.js
  line 35  col 29  Use '!==' to compare with '0'.

  ⚠  1 warning

[21:02:56] Finished 'hint' after 312 ms
[21:02:56] Starting 'clean'...
[21:02:56] Finished 'clean' after 62 ms
[21:02:56] Starting 'pack'...
The unused option is deprecated. Please use options.discardUnused instead.
The urls option is deprecated. Please use options.normalizeUrl instead.
The idents option is deprecated. Please use options.mergeIdents instead.
The idents option is deprecated. Please use options.reduceIdents instead.
[21:03:00] [webpack] Hash: 9333747ff2ef0a48d796
Version: webpack 1.12.14
Time: 4019ms
                        Asset       Size  Chunks             Chunk Names
js/30b83582.common-b-c.min.js   87 bytes       7  [emitted]  common-b-c
     img/0714810a.webpack.png    54.1 kB          [emitted]
     js/5dc5095f.chunk.min.js  418 bytes       1  [emitted]
     js/16442b8d.chunk.min.js  316 bytes       2  [emitted]
     js/6b7948c7.chunk.min.js    1.17 kB       3  [emitted]
         js/8ea76dd3.b.min.js  137 bytes       4  [emitted]  b
         js/281d1653.c.min.js  834 bytes       5  [emitted]  c
    js/88ce5035.vender.min.js    39.2 kB       6  [emitted]  vender
         js/b86c321b.a.min.js    1.35 kB       0  [emitted]  a
    js/e66d2930.common.min.js    54.4 kB       8  [emitted]  common
       css/793a9847.a.min.css   85 bytes       0  [emitted]  a
       css/088e175c.b.min.css   20 bytes       4  [emitted]  b
  css/9b5d21ad.common.min.css    3.42 kB       8  [emitted]  common
                       a.html  656 bytes          [emitted]
                       b.html    2.73 kB          [emitted]
                       c.html  495 bytes          [emitted]
chunk    {0} js/b86c321b.a.min.js, css/793a9847.a.min.css (a) 2.73 kB {8} [rendered]
    [0] ./src/js/a.js 1.36 kB {0} [built]
    [6] ./src/css/a.css 41 bytes {0} [built]
    [8] ./src/img/webpack.png 70 bytes {0} [built]
   [12] ./src/js/utils/url.js 1.26 kB {0} {5} [built]
chunk    {1} js/5dc5095f.chunk.min.js 1.7 kB {0} [rendered]
   [14] ./src/js/components/dialog.js 321 bytes {1} [built]
   [15] ./src/css/components/dialog.css 961 bytes {1} [built]
   [16] ./~/css-loader?minimize!./src/css/components/dialog.css 184 bytes {1} [built]
   [17] ./src/js/components/mask.js 238 bytes {1} [built]
chunk    {2} js/16442b8d.chunk.min.js 1.43 kB {0} [rendered]
   [18] ./src/js/components/toast.js 286 bytes {2} [built]
   [19] ./src/css/components/toast.css 958 bytes {2} [built]
   [20] ./~/css-loader?minimize!./src/css/components/toast.css 183 bytes {2} [built]
chunk    {3} js/6b7948c7.chunk.min.js 2.24 kB {0} [rendered]
   [21] ./src/js/helpers/ajax.js 1.79 kB {3} [built]
   [22] ./src/tmpl/list.tpl 454 bytes {3} [built]
chunk    {4} js/8ea76dd3.b.min.js, css/088e175c.b.min.css (b) 404 bytes {7} [rendered]
    [0] ./src/js/b.js 363 bytes {4} [built]
   [23] ./src/css/b.css 41 bytes {4} [built]
chunk    {5} js/281d1653.c.min.js (c) 1.63 kB {7} [rendered]
    [0] ./src/js/c.js 372 bytes {5} [built]
   [12] ./src/js/utils/url.js 1.26 kB {0} {5} [built]
chunk    {6} js/88ce5035.vender.min.js (vender) 88.1 kB [rendered]
    [0] multi vender 28 bytes {6} [built]
    [9] ./src/js/lib/zepto.js 88.1 kB {6} [built]
chunk    {7} js/30b83582.common-b-c.min.js (common-b-c) 51 bytes {8} [rendered]
   [25] ./src/js/helpers/bar.js 51 bytes {7} [built]
chunk    {8} js/e66d2930.common.min.js, css/9b5d21ad.common.min.css (common) 420 kB {6} [rendered]
    [1] ./src/css/common.css 41 bytes {8} [built]
    [3] ./~/css-loader/lib/css-base.js 1.51 kB {8} [built]
    [5] ./~/style-loader/addStyles.js 6.09 kB {8} [built]
   [10] ./~/lodash/index.js 411 kB {8} [built]
   [11] ./~/webpack/buildin/module.js 251 bytes {8} [built]
   [13] ./src/js/helpers/report.js 284 bytes {8} [built]

WARNING in js/b86c321b.a.min.js from UglifyJs
Side effects in initialization of unused variable dialog [./src/js/a.js:27,12]
Side effects in initialization of unused variable toast [./src/js/a.js:36,12]
Side effects in initialization of unused variable report [./src/js/a.js:21,4]

WARNING in js/5dc5095f.chunk.min.js from UglifyJs
Side effects in initialization of unused variable mask [./src/js/components/dialog.js:14,4]
Condition always false [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:10,0]
Dropping unreachable code [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:12,0]
Side effects in initialization of unused variable update [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:7,0]

WARNING in js/16442b8d.chunk.min.js from UglifyJs
Condition always false [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:10,0]
Dropping unreachable code [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:12,0]
Side effects in initialization of unused variable update [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:7,0]

WARNING in js/6b7948c7.chunk.min.js from UglifyJs
Dropping unused function print [./~/ejs-loader!./src/tmpl/list.tpl:4,0]
Side effects in initialization of unused variable __j [./~/ejs-loader!./src/tmpl/list.tpl:3,0]

WARNING in js/8ea76dd3.b.min.js from UglifyJs
Side effects in initialization of unused variable _ [./src/js/b.js:18,6]
Side effects in initialization of unused variable report [./src/js/b.js:20,6]
Side effects in initialization of unused variable bar [./src/js/b.js:21,6]

WARNING in js/281d1653.c.min.js from UglifyJs
Side effects in initialization of unused variable _ [./src/js/c.js:17,4]
Side effects in initialization of unused variable report [./src/js/c.js:19,4]
Side effects in initialization of unused variable bar [./src/js/c.js:20,4]
Side effects in initialization of unused variable url [./src/js/c.js:21,4]

WARNING in js/88ce5035.vender.min.js from UglifyJs
Side effects in initialization of unused variable docElem [./src/js/lib/zepto.js:1811,34]

WARNING in js/e66d2930.common.min.js from UglifyJs
Side effects in initialization of unused variable sourceMap [./~/style-loader/addStyles.js:185,0]
Side effects in initialization of unused variable media [./~/style-loader/addStyles.js:203,0]
Condition always false [./~/style-loader/addStyles.js:23,0]
Dropping unreachable code [./~/style-loader/addStyles.js:24,0]
Side effects in initialization of unused variable support [node_modules/lodash/index.js:932,0]
Condition always true [node_modules/lodash/index.js:12323,0]
Dropping unreachable code [node_modules/lodash/index.js:12337,0]
Side effects in initialization of unused variable moduleExports [node_modules/lodash/index.js:266,0]
Child html-webpack-plugin for "a.html":
     Asset     Size  Chunks       Chunk Names
    a.html  1.85 kB       0
    chunk    {0} a.html 429 bytes [rendered]
        [0] ./~/html-loader!./src/a.html 429 bytes {0} [built]
Child html-webpack-plugin for "c.html":
     Asset     Size  Chunks       Chunk Names
    c.html  1.69 kB       0
    chunk    {0} c.html 264 bytes [rendered]
        [0] ./~/html-loader!./src/c.html 264 bytes {0} [built]
Child html-webpack-plugin for "b.html":
     Asset  Size  Chunks       Chunk Names
    b.html  4 kB       0
    chunk    {0} b.html 2.51 kB [rendered]
        [0] ./~/html-loader!./src/b.html 323 bytes {0} [built]
        [1] ./src/img/icons/cart.png 2.19 kB {0} [built]
Child extract-text-webpack-plugin:
    chunk    {0} extract-text-webpack-plugin-output-filename 1.69 kB [rendered]
        [0] ./~/css-loader?minimize!./src/css/b.css 179 bytes {0} [built]
        [1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
Child extract-text-webpack-plugin:
    chunk    {0} extract-text-webpack-plugin-output-filename 5.14 kB [rendered]
        [0] ./~/css-loader?minimize!./src/css/common.css 1.46 kB {0} [built]
        [1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
        [2] ./src/img/sprites-icons.png 2.18 kB {0} [built]
Child extract-text-webpack-plugin:
                       Asset     Size  Chunks       Chunk Names
    img/0714810a.webpack.png  54.1 kB
    chunk    {0} extract-text-webpack-plugin-output-filename 1.83 kB [rendered]
        [0] ./~/css-loader?minimize!./src/css/a.css 257 bytes {0} [built]
        [1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
        [2] ./src/img/webpack.png 70 bytes {0} [built]
[21:03:00] Finished 'pack' after 5.98 s
[21:03:00] Starting 'default'...

events.js:154
      throw er; // Unhandled 'error' event
      ^
Error: Parse Error: <img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAqCAYAAADI3bkcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9y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zTGO9aeVFkwH3PsOFQpgtfBOWgHsUoQfAk+qpzlUoNuXmUflxJc9PFgpQjeAnugCTyrBMFK28JO8KyqttCwNJdqjzFbqBZrdhneB58VFPwi4nDxA3jCluu3Mosf0zSfssngUHe4T6VleoAdU06CF8EF6AKPJQse9iL4nNUWVSAhSyns8Igrdx0F87aQOR/TfzgKcvD7jptgFRaQIV6Lm+AMyLPZokWS4CT/b+tO0w245srNJGsT6d8oswQtexccBd/8vFgCNxPjr0fpeaKvfwrntUBkdulgo4Mug0SdebEE6TLNwnFjc6POsqyETDu4CS5sTltbWrWoYZx+z+fJanr9pWDBxeIr5UXwvzAMY7lQKG/nBgX6txkHuiRTK6R9CT4+OXlfEJzbahS4OS0mZwH+vSo22hY/nX3d9+tjay2T/oP2b4L9O+ulgP8vyWAT1JC7r7XKZQeNy/A8fy3iox/6Szv4ARCSOKfLO7DD9kMyTMIW6iE+gTf3G/1kmM4Uv0E1aACheDmMt5d28QussGekbU51n/dL34X4FZySXW7abfOdfuARqBegbRn+7g2aYQtMgi8ikhlGhqVs84NkWHpEAjw7AqbZ5zEwE8Kqd6dPZH8mzAxPs8otxn1J0HDtUy/nAClHn0EEvwIHYJdZIoxw7fOvAAMAw+irG/7RwKEAAAAASUVORK5CYII= /></p> <script src="js/88ce5035.vender.min.js"></script><script src="js/e66d2930.common.min.js"></script><script src="js/30b83582.common-b-c.min.js"></script><script src="js/8ea76dd3.b.min.js"></script></body> </html>
    at new global.HTMLParser (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlparser.js:243:15)
    at minify (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlminifier.js:826:5)
    at Object.global.minify (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlminifier.js:1176:12)
    at objectAssign.fileName (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:22:39)
    at module.exports (/Users/liupy525/Desktop/webpack-seed/node_modules/tryit/tryit.js:8:9)
    at minifyHtml (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:21:9)
    at Transform.htmlminTransform [as _transform] (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:51:7)
    at Transform._read (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_transform.js:159:10)
    at Transform._write (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_transform.js:147:83)
    at doWrite (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:313:64)
    at writeOrBuffer (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:302:5)
    at Transform.Writable.write (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:241:11)
    at write (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
    at emitNone (events.js:80:13)

npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/0.12.2_1/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v5.8.0
npm ERR! npm  v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! webpack-seed@0.1.0 build: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-seed@0.1.0 build script 'gulp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the webpack-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs webpack-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls webpack-seed
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/liupy525/Desktop/webpack-seed/npm-debug.log

看来是gulp-min和html-loader冲突了,html-loader也会把html压缩了,再交给gulp-min压缩的时候对dataUrl的图片压缩会出问题。。。

好的 我fix下 thx~

这个问题好像fix了吧。