0

I have a folder structure that looks something similar to the following

build/
  dist/
    app/
      js/
        third-party/
          jquery.min.js
        js-file1.js
        js-file2.js
    view/
      js/
        js-file.js
        js-file4.js

What I'd like to do is to use uglify to minify all JS files individually (while ignoring third-party javascript files) without bundling it all into a single file using grunt-contrib-uglify and overwrite the respective file. So essentially, if the originally file is build/dist/app/js/js-file1.js, after I ran the grunt task, it'd still be in build/dist/app/js/js-file1.js but minified.

The task looks like the following:

uglify: {
  options: {
    mangle: false,
    preserveComments: false
  },
  files: [{
    expand: true,     // Enable dynamic expansion.
    cwd: 'build/dist/',      // Src matches are relative to this path.
    src: ['**/*.js', '!**/thirdparty/*'], // Actual pattern(s) to match.
    dest: 'build/dist/',   // Destination path prefix.
    ext: '.js',   // Dest filepaths will have this extension.
    extDot: 'first'   // Extensions in filenames begin after the first dot
  }]
}

When I run the task, I get the following error and I am not sure what I've done wrong.

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded

Thoughts?

Koes Bong
  • 1,113
  • 3
  • 15
  • 28

0 Answers0