You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm having a weird error when running grunt with lot of tasks (~500).
The issue happens while running grunt-uglify but the root cause is the high number of multi tasks.
[RangeError: Maximum call stack size exceeded]
>> Uglifying source "rtl/dist/widget.history.unpack.js" failed.
Warning: Uglification failed.
Maximum call stack size exceeded.
Use --force to continue.
Aborted due to warnings.
With this pull request all tasks are now asynchronous and next task will run in a 'new' stack after the next tick.
@eddiemonge it's not the best project organization ever, but I have few thousands files in a very large project.
Files are analyzed by a task that generates the grunt configuration for concatenation and minification from a dependency management system.
This task generates a grunt uglify task for each destination file, and recently we passed the threshold of maximum stack size (~500).
Here's an example test from grunt-usemin which is now failing:
it('should work on CSS files',function(){grunt.file.mkdir('images');grunt.file.mkdir('images/misc');grunt.file.write('images/test.23012.png','foo');grunt.file.write('images/misc/test.2a436.png','foo');grunt.log.muted=true;grunt.config.init();grunt.config('usemin',{css: 'style.css'});grunt.file.copy(path.join(__dirname,'fixtures/style.css'),'style.css');grunt.task.run('usemin');grunt.task.start();varchanged=grunt.file.read('style.css');// Check replace has performed its dutyassert.ok(changed.match(/url\(\"images\/test\.23012\.png\"/));assert.ok(changed.match(/url\(\"images\/misc\/test\.2a436\.png\"/));assert.ok(changed.match(/url\(\"\/\/images\/test\.23012\.png\"/));assert.ok(changed.match(/url\(\"\/images\/test\.23012\.png\"/));});
Sorry, I know there's a lack of context here, but I'm pretty sure these assertions fail because grunt.task.run('usemin') now runs asynchronously and files didn't change yet. Is there an obvious way to run these assertions when the usemin task is done?
I'm not sure how to handle this. For starters, the grunt.task.start() method isn't really part of the public API and is only meant to be used internally. I definitely didn't intend people to use Grunt like this, but instead to test their plugins like we do with the contrib series.
@tkellen I'm wondering if there is a way we can revert this change where we made it and make it somewhere else, so that people can avoid this problem. Maybe we can add an option to grunt.task.start() that only Grunt uses internally like {async: true} to make this happen. Do you have any time to look at this today? I'm still teaching a class here.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm having a weird error when running grunt with lot of tasks (~500).
The issue happens while running grunt-uglify but the root cause is the high number of multi tasks.
With this pull request all tasks are now asynchronous and next task will run in a 'new' stack after the next tick.
This is very similar to gruntjs/grunt-contrib-imagemin#132