这就是我的grunt构建任务执行时间的样子。它从10-20分钟突然增加到3小时。
我可以看到ngtemplates:dist
和uglify:generated
占用了大部分执行时间,但3小时看起来有点笨拙的构建过程。它甚至不是那么庞大的应用程序,但它只是一个骨架应用程序,其功能有限。
可能的原因是什么,是否可以减少这种情况?
Execution Time (2018-02-10 09:16:37 UTC-0)
loading tasks 421ms 0%
loading grunt-contrib-clean 4ms 0%
clean:dist 16ms 0%
loading grunt-wiredep 3ms 0%
wiredep:app 279ms 0%
wiredep:test 33ms 0%
loading grunt-usemin 47ms 0%
useminPrepare:html 31ms 0%
loading grunt-concurrent 11ms 0%
concurrent:dist 2.6s 0%
loading grunt-postcss 68ms 0%
postcss:server 120ms 0%
postcss:dist 20ms 0%
loading grunt-...lar-templates 10ms 0%
ngtemplates:dist 44m 6.1s ▇▇▇▇▇▇▇ 24%
loading grunt-contrib-concat 245ms 0%
concat:generated 1.9s 0%
loading grunt-ng-annotate 588ms 0%
ngAnnotate:dist 1m 2s ▇ 1%
loading grunt-contrib-copy 81ms 0%
copy:dist 204ms 0%
loading grunt-contrib-cssmin 849ms 0%
cssmin:generated 2m 12.5s ▇ 1%
loading grunt-contrib-uglify 2.2s 0%
uglify:generated 2h 19m 21.9s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 75%
loading grunt-filerev 154ms 0%
filerev:dist 286ms 0%
usemin:html 164ms 0%
usemin:css 81ms 0%
usemin:js 509ms 0%
loading grunt-contrib-htmlmin 119ms 0%
htmlmin:dist 207ms 0%
swPrecache:production 399ms 0%
ngconstant:production 154ms 0%
Total 3h 6m 54.4s
答案 0 :(得分:0)
您可能正在处理的文件多于您需要的文件?如果需要这么长时间,请考虑这两点来加快这一过程。
考虑同时使用多个任务。 https://www.npmjs.com/package/grunt-concurrent
通过在文件顶部添加这些插件,自动加载所有grunt插件(https://www.npmjs.com/package/load-grunt-tasks。
require('load-grunt-tasks')(grunt);