Grunt uglifym - call stack size exceeded

青春壹個敷衍的年華 提交于 2019-12-05 18:05:39

I had the same problem, using an other Grunt plugin called recess. The error message was not explicit.

Warning: Cannot read property 'message' of undefined Use --force to continue.

But the verbose mode showed that my task was called hundred of times. The problem was that I created a "cyclic dependency" (causing an infinite loop) when I registered my task.

grunt.registerTask('recess', ['recess']); //does not work => cyclic dependency! 

The first parameter of registerTask method is an "alias task" and has to be different from the task names defined in the second parameter. I corrected like this:

grunt.registerTask('my-recess-task', ['recess']);

And I runned the task calling this (in the Command prompt window)

grunt my-recess-task

And then it was OK!

More about registerTask() method, from grunt API: http://gruntjs.com/api/grunt.task#grunt.task.registertask

I also met this problem, i solved this by removing grunt.registerTask('uglify', ['uglify']);

before i solved this, i ran grunt uglify -v to check what happend.

I found it because that where you using this grunt.loadNpmTasks('grunt-contrib-uglify'); ,it implicitly executes the grunt.registerTask('uglify', ['uglify']); ^_^

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!